【问题标题】:Getting System.NotSupportedException when running WCF Service in Visual Studio 2010在 Visual Studio 2010 中运行 WCF 服务时出现 System.NotSupportedException
【发布时间】: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 文件中,但问题仍然存在。

任何帮助将不胜感激......

【问题讨论】:

    标签: wcf visual-studio-2010


    【解决方案1】:

    我认为您应该看一下:“file:///H:\Personal\Visu...”。为什么是文件://? WCF 服务应托管在 Visual Studio 中包含的“开发人员 iis”中。这应该会导致类似:“http://localhost/abc...”

    【讨论】:

      【解决方案2】:

      将我的解决方案从网络驱动器移到本地 C:\ 并开始正常工作

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2011-03-26
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-09-10
        • 1970-01-01
        相关资源
        最近更新 更多