将.dll文件加载到silverlight中(使用IIS7托管)

时间:2010-04-05 21:58:06

标签: silverlight iis-7 assemblies loading dll

我似乎在将.dll文件加载到我的silverlight应用程序时遇到了问题。

this.pluginDownloader = new WebClient();
this.pluginDownloader.OpenReadCompleted += new OpenReadCompletedEventHandler(pluginDownloader_OpenReadCompleted);
this.pluginDownloader.DownloadProgressChanged += new DownloadProgressChangedEventHandler(pluginDownloader_DownloadProgressChanged);

String path = String.Format("http://localhost/Resources/Plugins/{0}.dll", this.pluginDetails.AssemblyName);
this.pluginDownloader.OpenReadAsync(new Uri(path, UriKind.Relative));

我可以通过导航到它来手动下载.dll程序集文件(例如:http://localhost/Resources/Plugins/myAssembly.dll)但是当执行上面的代码时它只会停止silverlight应用程序。这在我在visual studio中启动项目时起作用,因此它必须是IIS7中的一些设置。

任何人都知道如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

感谢回答杰夫...我也尝试了相对路径,但这也没有用。我认为绝对URL是最好的尝试,因为我可以使用localhost链接实际导航和下载程序集文件。

编辑: 得到它的工作 - 如果我将localhost替换为它工作的服务器的实际IP地址

String path = String.Format("http://192.168.2.107/code/Platform/Website/Resources/Plugins/{0}.dll", this.pluginDetails.AssemblyName); this.pluginDownloader.OpenReadAsync(new Uri(path, UriKind.Absolute));

我仍然想知道如何使用相对路径让它工作...... 相对路径应该有效 - 我正在使用同一类中的一个来加载图像

this.pluginImage.Source = new BitmapImage(new Uri("/Resources/Plugins/PluginTile/" + this.pluginDetails.ImageFilename, UriKind.Relative));

...奇怪

相关问题