微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

c# – 相对URI,错误浏览SVC服务不支持此操作

浏览到网站的svc服务时我会收到以下错误(在它所在的服务器上浏览它).该网站使用IIS7.

This operation is not supported for a relative URI.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more @R_867_4045@ion about the error and where it originated in the code.

Exception Details: system.invalidOperationException: This operation is not supported for a relative URI.

Source Error:

An unhandled exception was generated during the execution of the current web request. @R_867_4045@ion regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[InvalidOperationException: This operation is not supported for a relative URI.]
   System.Uri.get_Scheme() +8045854
   System.ServiceModel.HostingManager.FilterBaseAddressList(Uri[] baseAddresses,Uri[] prefixFilters) +142
   System.ServiceModel.HostingManager.CreateService(String normalizedVirtualPath) +598
   System.ServiceModel.HostingManager.ActivateService(String normalizedVirtualPath) +50
   System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath) +1172

[ServiceActivationException: The service '/Templates/eDemokrati/Services/eDemokratiService.svc' cannot be activated due to an exception during compilation.  The exception message is: This operation is not supported for a relative URI..]
   System.Runtime.AsyncResult.End(IAsyncResult result) +900192
   System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +192830
   System.Web.AsyncEventExecutionStep.OnAsyncEventCompletion(IAsyncResult ar) +107


Version @R_867_4045@ion: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272

链接到该服务:Link

站点的一些web.config

<system.serviceModel>
  <serviceHostingEnvironment>
        <baseAddressprefixFilters>
            <add prefix="http://www.roros.kommune.no/"/>
            <add prefix="www.roros.kommune.no/"/>
            <add prefix="item"/>
            <add prefix="http://www.roros.kommune.no/templates/eDemokrati/Services/"/>
            <add prefix="www.roros.kommune.no/templates/eDemokrati/Services/"/>

        </baseAddressprefixFilters>
    </serviceHostingEnvironment>

由此引起的错误是什么以及如何解决

解决方法

如异常消息所示,不允许使用相对URI.尝试删除prefix =“item”并将它们全部设为绝对URI.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐