相关疑难解决方法(0)

请求WCF服务合同时出现HTTP错误请求错误

我有一个WCF服务,具有以下配置:

<system.serviceModel>
    <behaviors>
        <serviceBehaviors>
            <behavior name="MetadataEnabled">
                <serviceDebug includeExceptionDetailInFaults="true" />
                <serviceMetadata httpGetEnabled="true" />
            </behavior>
        </serviceBehaviors>
     </behaviors>
      <services>
          <service behaviorConfiguration="MetadataEnabled" name="MyNamespace.MyService">
              <endpoint name="BasicHttp"
                        address=""
                        binding="basicHttpBinding"
                        contract="MyNamespace.IMyServiceContract" />
              <endpoint name="MetadataHttp"
                        address="contract"
                        binding="mexHttpBinding" 
                        contract="IMetadataExchange" />
              <host>
                  <baseAddresses>
                      <add baseAddress="http://localhost/myservice" />
                  </baseAddresses>
              </host>
          </service>
    </services>
</system.serviceModel>
Run Code Online (Sandbox Code Playgroud)

WcfSvcHost.exe进程中托管服务时,如果我浏览到URL:

HTTP://本地主机/为MyService /合同

服务元数据可用的地方我收到HTTP 400 Bad Request错误.

通过检查WCF日志,我发现抛出了System.Xml.XmlException异常,并显示消息:" 无法读取消息正文,因为它是空的. "
以下是日志文件的摘录:

<Exception>
<ExceptionType>
System.ServiceModel.ProtocolException, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
</ExceptionType>
<Message>There is a problem with the XML that was received from the network. See …
Run Code Online (Sandbox Code Playgroud)

wcf wsdl exception http

12
推荐指数
2
解决办法
8万
查看次数

将大型XML从Silverlight发送到WCF

我想从Silverlight向WCF SVC服务发送一个大的XML字符串.

看起来大约50k以下的任何东西都被正确发送但是如果我尝试发送超过该限制的东西,我的请求到达服务器(调用BeginRequest)但从未到达我的SVC.我得到了经典的"NotFound"异常.

关于如何提高这个限制的任何想法?

如果我不能提高它?我还有什么其他选择?

这是我的绑定配置

<bindings>
        <customBinding>
            <binding name="customBinding0" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" maxBufferPoolSize="2147483647">
                <binaryMessageEncoding>
        <readerQuotas
            maxArrayLength="2147483647"
            maxBytesPerRead="2147483647"
            maxDepth="2147483647"
            maxNameTableCharCount="2147483647"
            maxStringContentLength="2147483647" />

      </binaryMessageEncoding>
                <httpTransport/>
            </binding>
            <binding name="customBindingSecure" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" maxBufferPoolSize="2147483647">
                <binaryMessageEncoding>
        <readerQuotas
            maxArrayLength="2147483647"
            maxBytesPerRead="2147483647"
            maxDepth="2147483647"
            maxNameTableCharCount="2147483647"
            maxStringContentLength="2147483647" />
                </binaryMessageEncoding>
                <httpsTransport/>
            </binding>
        </customBinding>
    </bindings>
Run Code Online (Sandbox Code Playgroud)

编辑:更多细节:如果我打破Global.asax Endrequest,我在响应"Bad Request 400"中看到

编辑:再次提供更多详细信息:我激活了跟踪,我可以看到以下错误:已超出传入邮件的最大邮件大小配额(65536).要增加配额,请在相应的绑定元素上使用MaxReceivedMessageSize属性.

但是,我的maxReceivedMessageProperty已设置为2147483647.

.net silverlight wcf

5
推荐指数
1
解决办法
9350
查看次数

远程服务器返回意外响应:(400)错误请求

调用我的WCF服务方法时,我没有收到任何错误.

这个名为SaveTemplate()的特殊方法接受byte []的输入.

我正在使用大小为byte [806803]的文件测试此方法,但以错误结束:

WCF - 远程服务器返回意外响应:(400)错误请求.*

我已经查看了我在Google上找到的几个搜索结果,并根据这些在app.config中进行了一些更改,但仍然收到错误:-(

这是我的WCF服务库的App.Config文件:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.web>
    <compilation debug="true" />
  </system.web>

  <system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding name="wsHttp" maxReceivedMessageSize="50000000" maxBufferPoolSize="50000000"
        messageEncoding="Mtom" >
          <readerQuotas maxDepth="500000000" maxStringContentLength="500000000" maxArrayLength="500000000"
          maxBytesPerRead="500000000" maxNameTableCharCount="500000000" />
          <security mode="None"></security>
        </binding>
      </wsHttpBinding>
    </bindings>

    <services>
      <service behaviorConfiguration="ReportingComponentLibrary.TemplateServiceBehavior"
        name="ReportingComponentLibrary.TemplateService">
        <endpoint address="" binding="wsHttpBinding" contract="ReportingComponentLibrary.ITemplateService" bindingConfiguration="wsHttp" >
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" ></endpoint>
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8080/ReportingComponentLibrary/TemplateService/" />
          </baseAddresses>
        </host>
      </service>

      <service behaviorConfiguration="ReportingComponentLibrary.TemplateServiceBehavior"
        name="ReportingComponentLibrary.TemplateReportService">
        <endpoint address="" binding="wsHttpBinding" contract="ReportingComponentLibrary.ITemplateReportService" bindingConfiguration="wsHttp" >
          <identity> …
Run Code Online (Sandbox Code Playgroud)

service wcf

4
推荐指数
1
解决办法
4万
查看次数

标签 统计

wcf ×3

.net ×1

exception ×1

http ×1

service ×1

silverlight ×1

wsdl ×1