开发者

Loading remote assembly from the webservice with reflection

开发者 https://www.devze.com 2022-12-27 12:55 出处:网络
I am using Assembly.LoadFrom within a web service to load assemblies from a web site. but the problem is it is in the virutal directory and the server.mappath parses the url like\\share\\mydll.dll and

I am using Assembly.LoadFrom within a web service to load assemblies from a web site. but the problem is it is in the virutal directory and the server.mappath parses the url like \share\mydll.dll and loadform method failed. Is there anyway to reference dll from the remote location?

I've tried passing the url (http://localhost/downloadable/mydll.dll) and again it got "Could not load file or assembly 'http://localhost/downloadable/mydll.dll' or one of its dependencies. HTTP down开发者_StackOverflowload of assemblies has been disabled for this appdomain. (Exception from HRESULT: 0x80131048)"


You can use the WebClient class to download an assembly over the internet:

using(var wc = new WebClient()) {
    Assembly.Load(wc.DownloadData(url));
0

精彩评论

暂无评论...
验证码 换一张
取 消