【发布时间】:2011-11-28 13:03:24
【问题描述】:
我使用 Visual Studio 2010 创建了 WCF 服务。当我尝试运行该服务时,我收到以下错误
文件名:'file:///H:\Personal\Visual Studio 2010\Projects\WPFBrowser\DatabaseService\bin\Debug\DatabaseService.dll' ---> System.NotSupportedException: 试图加载一个 从网络位置组装,这将导致组装 在以前版本的 .NET Framework 中被沙盒化。这 .NET Framework 的发布默认不启用 CAS 策略, 所以这个负载可能很危险。如果此负载不打算用于沙箱 程序集,请启用 loadFromRemoteSources 开关。看 http://go.microsoft.com/fwlink/?LinkId=155569 了解更多信息。
在 System.Reflection.RuntimeAssembly._nLoad(AssemblyName 文件名, 字符串 codeBase、证据 assemblySecurity、RuntimeAssembly locationHint, StackCrawlMark& stackMark, 布尔 throwOnFileNotFound, Boolean for Introspection, Boolean suppressSecurityChecks) 在 System.Reflection.RuntimeAssembly.nLoad(AssemblyName 文件名,字符串 codeBase,证据 assemblySecurity,RuntimeAssembly locationHint, StackCrawlMark& stackMark,布尔 throwOnFileNotFound,布尔 forIntrospection, Boolean suppressSecurityChecks) 在 System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef,证据 assemblySecurity,StackCrawlMark 和 stackMark, Boolean for Introspection, Boolean suppressSecurityChecks) 在 System.Reflection.Assembly.Load(AssemblyName assemblyRef) 在 Microsoft.Tools.SvcHost.ServiceHostHelper.LoadServiceAssembly(字符串 svcAssemblyPath)
我什至尝试过设置
<configuration>
<runtime>
<loadFromRemoteSources enabled="true" />
</runtime>
</configuration>
在 app.config 文件中,但问题仍然存在。
任何帮助将不胜感激......
【问题讨论】: