【问题标题】:WCF Service wsHttpBindingWCF 服务 wsHttpBinding
【发布时间】:2017-04-03 01:14:06
【问题描述】:

我在使用 wsHtpBinding 帮助页面创建 wcf 服务时遇到错误,并且服务也无法正常工作

帮助页面错误

找不到资源。说明:HTTP 404。您要查找的资源(或其依赖项之一)可能已被删除、名称已更改或暂时不可用。请查看以下 URL 并确保其拼写正确。 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>

【问题讨论】:

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


    【解决方案1】:

    就我而言,我发现在 IIS/网站上安装了一个 Microsoft IIS 过滤模块Url Scan 3.1,它有自己的限制,可以根据内容大小拒绝传入的请求并返回“404 Not found page”。

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

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

    MaxAllowedContentLength=314572800

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-10-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-08-31
      • 1970-01-01
      • 2011-02-15
      • 1970-01-01
      相关资源
      最近更新 更多