简体   繁体   English

WCF服务wsHttpBinding

[英]WCF Service wsHttpBinding

I'm getting error while creating wcf service using wsHtpBinding help page is getting error and services also not working 使用wsHtpBinding帮助页面创建wcf服务时出现错误,服务也无法正常工作

Help Page Error : 帮助页面错误

The resource cannot be found. 无法找到该资源。 Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. 说明:HTTP404。您正在寻找的资源(或其依赖项之一)可能已被删除,名称更改或暂时不可用。 Please review the following URL and make sure that it is spelled correctly. 请查看以下网址,并确保其拼写正确。 http://localhost:80/Service1.svc/help http:// localhost:80 / Service1.svc / help

My old working wsHttpbinding project web.config but it's not working now: 我以前使用的wsHttpbinding项目web.config,但现在无法使用:

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>

In my case, I found out that a Microsoft IIS filtering module Url Scan 3.1 was installed on IIS/website, which have it's own limit to reject incoming requests based on content size and return "404 Not found page". 以我为例,我发现在IIS /网站上安装了Microsoft IIS过滤模块Url Scan 3.1 ,它具有根据内容大小拒绝传入请求并返回“ 404未找到页面”的限制。

It's limit can be updated in %windir%\\System32\\inetsrv\\urlscan\\UrlScan.ini file by setting MaxAllowedContentLength to the required value. 通过将MaxAllowedContentLength设置为所需值,可以在%windir%\\System32\\inetsrv\\urlscan\\UrlScan.ini文件中更新此限制。

For eg. 例如。 following will allow upto 300 mb requests 以下将允许最多300 mb的请求

MaxAllowedContentLength=314572800 MaxAllowedContentLength = 314572800

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM