Rv Singh

Rv Singh

  • 1.5k
  • 245
  • 90.2k

WCF Service or an aspx page on IIS 7.5 only works when w3wp

Jan 21 2014 5:59 AM
I'm encountering a problem where upon I am loading up a WCF service into IIS. Contained within this service is a reference to a DLL that wraps around a native static Lib file. This lib launches an exe and allows api access into the exe. When I run the service using Visual Studio's debugger, everything runs properly. However, when I load it up onto IIS and make a call to the service, it crashes claiming heap corruption. I have tried using asp.net impersonation, changing the identity of the w3wp.exe worker to a user that has executable right to the exe. I even went so far as to use an administrator account as the impersonation and identity, still no joy. When the exception occurs, it tells me that the user doesn't have adequate permission to execute the JIT and will need to be elevated to an Administrator.

Now, this is where it gets peculiar. After being elevated, the service may then execute as expected as long as the w3wp.exe continues to run. If the w3wp.exe is stopped and restarted then it will throw the exception again. I've done a stack trace of the issue and have given IIS permission to access the files that the service is dependent upon as well as the DLL's dependencies. I have verified that the values in the DLL are being properly handled and that it doesn't corrupt before making a call into the Lib file.