Mixed mode assembly loading in asp.net
I have an asp.net webservice that references a mixed mode dll. The native dll's that the mixed mode assembly reference are in a directory that is added to SYSTEM PATH.
I want to remove the native dll's directory from the SYSTEM PATH, so I copied all the native dll's to webservice's bin directory, but I get file not found exception.
Does asp.net not look in webservice's bin directory for native dlls? Is there a way to dynamically set the SYSTEM PATH? How can I get this to work.
If anyone is facing a similar situation, this is what I did to be able to load a mixed mode assembly from a location not in these locations:
I set the native dlls on the mixed mode assembly to be delay loaded. Then I followed option 2b from http://blogs.msdn.com/b/jorman/archive/2007/08/31/loading-c-assemblies-in-asp-net.aspx
I just had to make one minor tweak to the option 2b. It says to update "Application_Start" method in Global.asax, but I had to update the "Application_BeginRequest" method to get this to work with my webservice.
链接地址: http://www.djcxy.com/p/44540.html上一篇: IIS ASP.NET MVC和dllimport调用会锁定该文件,以防未来部署
下一篇: 在asp.net中加载混合模式程序集