Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7812505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T04:31:46+00:00 2026-06-02T04:31:46+00:00

I have an application that runs as a WCF webservice on IIS7. It calls

  • 0

I have an application that runs as a WCF webservice on IIS7. It calls a COM control and this control then loads another dll with data. This application has been in use for quite a while and normally works fine, but recently I ran into a problem on one machine where the LoadLibrary call to load the data dll fails. However, the call doesn’t always fail, it will work for the first call after the IIS service is restarted, and then fails after that.

The data dll exists in the same directory as the COM control, and the current directory is set to this directory. I’ve checked and the current directory does not get set to another directory, it stays the same for both calls. The separate calls are separate calls to the webservice and in between them the com control gets unloaded, as does the data dll.

The data dll loads fine if I place it in the system directory or use the full path to the dll in the com directory, so I can work around this, but I’m just wondering why it would happen. When I call GetLastError after it fails to load the module, as I mentioned it just gives me ‘The specified module could not be found’ error.

The MSDN description for LoadLIbrary says that the current directory should be searched and all the other installations where this has worked seems to suggest that it normally does. The machine that it’s failing on is a Windows Server 2008 R2 machine, although the application has been run on this type of machine many times before.

Any ideas are welcome. Is there a way to get LoadLibrary to enumerate where it’s looking?

Thanks,
Jordan

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T04:31:47+00:00Added an answer on June 2, 2026 at 4:31 am

    I haven’t found a function that will enumerate all the DLL search paths, and it looks rather complicated: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682586%28v=vs.85%29.aspx

    The Windows behavior of searching the current working directory for libraries (in addition to the location of the .exe) is considered a potential security flaw. That article describes some ways to exclude the current directory within a process, including the SetDllDirectory function. I don’t know how IIS works, but if you don’t control the process, maybe someone else is tampering with the search settings? I think GetDllDirectory will tell you if that changed.

    There is also a global registry setting that disables searching the working directory, but since your load isn’t always failing I have to guess that’s not the cause.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi i have a WP7 application that calls a wcf who runs with membership
I have a web application that contains a WCF library. The web app runs
I have a silverlight application that runs WCF services. I have created a WCF
We have a large process in our application that runs once a month. This
I have This application that runs it the background well its supposed to. the
I have a WCF service that runs in my web application that provides data
I have a WCF application that normally runs in IIS (for my testing and
I have an asp.net web application that makes calls to several WCF services. The
I have a application that runs very well on JBoss using JSF 2. I
I have an application that runs on a shared hosting website - it is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.