Svc aspNetCompatibilityEnabled=“true”导致 ServiceActivationException

发布于 2024-08-12 01:03:45 字数 237 浏览 7 评论 0原文

我在 Web 应用程序中有一系列 svc 文件,它们都工作正常,但我需要将 aspNetCompatibilityEnabled 设置为 true 来运行,现在我收到以下异常

System.ServiceModel.ServiceActivationException:请求的服务,'...'无法激活。有关详细信息,请参阅服务器的诊断跟踪日志。

它谈到的这些跟踪日志在哪里以及可能导致这种情况的原因是什么?

谢谢

I have a series of svc files within a web application, they all worked fine but I have a need to run with aspNetCompatibilityEnabled set to true and now I get the following exception

System.ServiceModel.ServiceActivationException: The requested service, '...' could not be activated. See the server's diagnostic trace logs for more information.

Where are these trace logs that it talks about and what could be causing this?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

别念他 2024-08-19 01:03:45

因此,当将 aspNetCompatibilityEnabled 设置为 true 时,您需要在几个地方应用更改。首先,我猜你已经在 web.config 文件中完成了它。其次,您需要通过使用 AspNetCompatibilityRequirements 属性装饰服务类来应用对服务的更改:

C#

[AspNetCompatibilityRequirements(
    RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class MySampleService
{

}

VB

<Activation.AspNetCompatibilityRequirements( _
RequirementsMode:=Activation.AspNetCompatibilityRequirementsMode.Allowed)> _
public class MySampleService 

End Class

如果所有服务都允许,您可以使用此属性装饰基服务类,以便默认情况下所有服务都会继承它。

So when turning aspNetCompatibilityEnabled to true, you need to apply changes in a couple of places. Firstly, i'm guessing you've done it in your web.config file. Secondly, you'll need to apply changes to services by decorating the service classes with AspNetCompatibilityRequirements attributes:

C#

[AspNetCompatibilityRequirements(
    RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class MySampleService
{

}

VB

<Activation.AspNetCompatibilityRequirements( _
RequirementsMode:=Activation.AspNetCompatibilityRequirementsMode.Allowed)> _
public class MySampleService 

End Class

You can, if all services allow it, decorate a base service class with this attribute so it's inherited by all services by default.

偏爱你一生 2024-08-19 01:03:45

您可以通过将以下内容添加到 web.config 来激活广泛的日志记录信息:

<system.diagnostics>
  <trace autoflush="true">
    <listeners>
    </listeners>
  </trace>
  <sources>
    <source name="System.ServiceModel"
            switchValue="Information, ActivityTracing"
            propagateActivity="true">
      <listeners>
        <add name="sdt"
             type="System.Diagnostics.XmlWriterTraceListener"
             initializeData= "WcfDetailTrace.txt" />
      </listeners>
    </source>
  </sources>
</system.diagnostics>

然后您可以使用 SvcTraceViewer.exe 查看日志文件

You could activate extensive logging information by adding the following to your web.config:

<system.diagnostics>
  <trace autoflush="true">
    <listeners>
    </listeners>
  </trace>
  <sources>
    <source name="System.ServiceModel"
            switchValue="Information, ActivityTracing"
            propagateActivity="true">
      <listeners>
        <add name="sdt"
             type="System.Diagnostics.XmlWriterTraceListener"
             initializeData= "WcfDetailTrace.txt" />
      </listeners>
    </source>
  </sources>
</system.diagnostics>

Then you could use SvcTraceViewer.exe to view the log file

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文