简体   繁体   中英

Web service works in asp.net but not IIS

I have built a web service that uses DLLImport to access unmanaged code. The service works just fine running in ASP.NET server, but the application is generating an error once I run it from IIS. I have checked permissions, moved the DLL to the system32 folder, etc.... I am not sure what else to do. The service needs to run in IIS. What should I do?

The main difference from VS's ASP.NET server and IIS is that IIS uses ASP.NET as a default user, but VS's server uses your user to work. check is ASP.NET user have access to execute code in system32? provide more detailed error message, to give us to understand the problem.

It might be an issue with the default trust level. Try running your app at the FullTrust level and see what happens:

http://msdn.microsoft.com/en-us/library/tkscy493.aspx

If it's an authenticated service you could turn on impersonation to carry your credentials through.

To turn on impersonation :

http://msdn.microsoft.com/en-us/library/xh507fc5.aspx

In web.config

<system.web>
    <identity impersonate="true"/>
</system.web>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM