在将大数据作为输入时未发现端点问题

时间:2016-02-18 14:52:03

标签: c# wcf binding web-config

尝试从我的服务中获取时,似乎遇到了未找到服务端点的问题。当我提供大数据作为输入时会发生这种情况。

以下是绑定

客户端web.config绑定

<binding name="MyMtomHttp" sendTimeout="23:59:00" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Mtom" transactionFlow="True" receiveTimeout="23:59:00">
   <readerQuotas maxDepth="64" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
   <security mode="Message">
      <transport clientCredentialType="Windows" proxyCredentialType="None" />
      <message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" establishSecurityContext="true" />
   </security>
</binding>

<endpoint address="http://localhost:58164/Sample.svc" binding="wsHttpBinding" bindingConfiguration="MyMtomHttp" behaviorConfiguration="LargeData" contract="MyService.ISample" name="MyMtomHttp">
    <identity>
      <dns value="localhost" />
    </identity>
</endpoint>

<behaviors>
  <endpointBehaviors>
    <behavior name="LargeData">
      <dataContractSerializer maxItemsInObjectGraph="2147483647" />
    </behavior>
  </endpointBehaviors>
</behaviors>

服务器端web.config绑定

<behavior name="SampleBehavior">
  <serviceMetadata httpGetEnabled="true" />
  <serviceDebug includeExceptionDetailInFaults="true" />
  <serviceThrottling maxConcurrentCalls="10000" maxConcurrentSessions="10000" maxConcurrentInstances="10000" />
  <dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>

<bindings>
  <wsHttpBinding>
    <binding name="MyMtomHttp" sendTimeout="23:59:00" maxBufferPoolSize="2147483647" maxReceivedMessageSize ="2147483647" messageEncoding="Mtom" transactionFlow="True" receiveTimeout="23:59:00">
      <readerQuotas maxDepth="64" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
      <security mode="Message">
        <transport clientCredentialType="Windows" proxyCredentialType="None" />
        <message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" establishSecurityContext="true" />
      </security>
    </binding>
  </wsHttpBinding>
</bindings>

<services>
  <service behaviorConfiguration="SampleBehavior" name="MyMtomHttp">
    <endpoint name="MyMtomHttp" bindingConfiguration="MyMtomHttp" address="" binding="wsHttpBinding" bindingNamespace="http://Sample/" contract="MyService.ISample">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
</services>

我尝试了所有可能的解决方案,包括使用maxRequestLength。但我仍然得到相同的端点未找到错误。

以下是确切的错误消息:

System.ServiceModel.EndpointNotFoundException: There was no endpoint listening at http://localhost:58164/Sample.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. ---> System.Net.WebException: The remote server returned an error: (404) Not Found.
   at System.Net.HttpWebRequest.GetResponse()
   at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)

2 个答案:

答案 0 :(得分:1)

找到this发布的解决方案......

解决方案是将此添加到网络配置:

<configuration>
...
  <system.webServer>
    <security>
      <requestFiltering>
        <requestLimits maxAllowedContentLength="204800000" />
      </requestFiltering>
    </security>
  </system.webServer>  
</configuration>

答案 1 :(得分:0)

分享你得到的确切例外。

另外,你能参考这两篇文章,看看它是否有帮助......