在Web主机服务器上使用WCF服务

时间:2018-06-03 12:36:04

标签: asp.net web-services wcf soap

这是一个重复问题的可能性很高。 我再次查询它的原因是,我搜索了大量的文章无济于事。我需要一些指导,也许它可能与我的申请有关。

我已经编写了一个WCF服务,它可以在localhost上正常工作。 一旦网站发布到实时托管服务器, *我无法访问WSDL - 我获得了404 - 文件或目录未找到。 *我应该尝试添加服务引用到应用程序,我得到:

There was an error downloading 'http://freewaytoyota.co.za/FreewayToyotaService.svc/$metadata'.
The request failed with HTTP status 403: ModSecurity Action.
Metadata contains a reference that cannot be resolved: 'http://freewaytoyota.co.za/FreewayToyotaService.svc'.
The HTTP request was forbidden with client authentication scheme 'Anonymous'.
The remote server returned an error: (403) Forbidden.
If the service is defined in the current solution, try building the solution and adding the service reference again.

我的web.config如下:

 <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_IFreewayToyotaService" />
      </basicHttpBinding>
    </bindings>
    <client>
    <endpoint address="http://localhost:8777/FreewayToyotaService.svc"
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IFreewayToyotaService"
        contract="FreewayServiceReference.IFreewayToyotaService" name="BasicHttpBinding_IFreewayToyotaService" />
    </client>
    <behaviors>
      <serviceBehaviors>
        <behavior name="">
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" minFreeMemoryPercentageToActivateService="1"/>
  </system.serviceModel>

我没有做任何改变。这是原始文件。 如何修改它以使.svc在实时Web主机服务器上运行。 请帮助:(。提前致谢。

0 个答案:

没有答案