WCF服务wsHttpBinding

时间:2016-11-19 06:00:00

标签: asp.net .net wcf wcf-binding wcf-security

我在使用wsHtpBinding帮助页面创建wcf服务时出错是收到错误而服务也无法正常工作

帮助页面错误

  

无法找到资源。说明:HTTP 404.您要查找的资源(或其中一个依赖项)可能已被删除,名称已更改或暂时不可用。请查看以下网址,确保拼写正确。   http://localhost:80/Service1.svc/help

我的老工作wsHttpbinding项目web.config但它现在不能正常工作:

的web.config

<?xml version="1.0"?>
<configuration>
  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" executionTimeout="3600" maxRequestLength="10000000"/>
    <customErrors mode="Off" />
  </system.web>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="MyServiceTypeBehaviors">
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
        </behavior>
        <behavior name="">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
      <wsHttpBinding >
        <binding name="MyBasicwsHttpBinding">
          <security mode="None">
            <transport clientCredentialType="None" />
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
    <services>
      <service behaviorConfiguration="MyServiceTypeBehaviors"  name="WcfService1.Service1">
        <endpoint address="mex"  binding="wsHttpBinding" bindingConfiguration="MyBasicwsHttpBinding" name="WcfService1.Service1" contract="WcfService1.IService1"/>
      </service>
    </services>
    <serviceHostingEnvironment minFreeMemoryPercentageToActivateService="0" aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <directoryBrowse enabled="true"/>
  </system.webServer>
</configuration>

1 个答案:

答案 0 :(得分:0)

在我的情况下,我发现在IIS /网站上安装了一个Microsoft IIS过滤模块Url Scan 3.1,它有自己的限制来根据内容大小拒绝传入请求并返回&#34 ; 404未找到页面&#34;。

通过将%windir%\System32\inetsrv\urlscan\UrlScan.ini设置为所需的值,可以在MaxAllowedContentLength文件中更新该限制。

例如。以下将允许最多300 MB的请求

MaxAllowedContentLength = 314572800