WCF服务失败 - HTTP / 1.1 400错误请求[\ r] [\ n] [英] WCF Service failing - HTTP/1.1 400 Bad Request[\r][\n]

查看:79
本文介绍了WCF服务失败 - HTTP / 1.1 400错误请求[\ r] [\ n]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我在调用我的WCF服务时遇到异常更大的请求xml对象内容长度65708,它在哪里工作没有任何问题请求xml文件的内容长度小于此值。这是我们向外部客户端公开的服务,我使用SoapUI调试服务,我得到异常HTTP / 1.1 400错误请求[\ r] [\ n],甚至没有达到调试点。我很好地使用了所提供的配置值,但没有一个帮助我解决问题。



所有配置更改后,我的web.config文件看起来像这样(只有绑定部分)。

Hi All,

I was getting exception while making a call the my WCF service more larger request xml object content length 65708, where it is working without any issues with request xml file content length less than this. This is service we are exposed to external clients and I used SoapUI to debug the service and I am getting the exception HTTP/1.1 400 Bad Request[\r][\n] and not even hitting to the debug point. I goggled a lot and applied the configuration values provided, but none of them helped me to resolve the issue.

After all the config changes, my web.config file is looks like this (only binding part).

<bindings>
      <basichttpbinding>
        <binding name="GDASHttp" closetimeout="00:10:00" opentimeout="00:10:00" receivetimeout="00:10:00" sendtimeout="00:10:00" bypassproxyonlocal="false" hostnamecomparisonmode="StrongWildcard" maxbuffersize="2147483647" maxbufferpoolsize="2147483647" maxreceivedmessagesize="2147483647" messageencoding="Mtom" textencoding="utf-8" transfermode="Streamed" usedefaultwebproxy="true">
          <readerquotas maxdepth="2147483647" maxstringcontentlength="2147483647" maxarraylength="2147483647" maxbytesperread="2147483647" maxnametablecharcount="2147483647" />
          <security mode="TransportCredentialOnly">
            <transport clientcredentialtype="Windows" />
          </security>
        </binding>
</basichttpbinding>





我没有改变任何客户端文件中的设置,因为我可以从SoapUI获取异常,并且问题仅与服务器配置有关。我确实理解了一些设置是根据文件大小接受的问题,但不确定我们在上述设置中可以提供的最大值是什么。



我修改了根据服务器中某些Google建议的IIS设置,这是我更改的applicationhost.config文件。





I didn't changed any settings in the client file as I can getting the exception from SoapUI and issue is related to server configuration only. I do understand the issue with some the settings is accepting according to the file size, but not sure what is maximum values we can provide in the above settings.

I modified the IIS settings as per some of the Google advises in the server and this is my changed applicationhost.config file.

<location path="Default Web Site/GDAS.FY15R2.3.1/Trusted" overridemode="Allow">
        <system.webserver>
            <handlers accesspolicy="Read, Execute" />
            <security>
                <ipsecurity>
                    <add ipaddress="127.0.0.1" subnetmask="255.255.255.255" allowed="true" />
                </ipsecurity>
                        <requestfiltering> 
                        <requestlimits maxallowedcontentlength="40000000" /> 
                        </requestfiltering> 
            </security>
            <serverruntime uploadreadaheadsize="2147483647" />
        </system.webserver>
    </location>





有谁可以帮助我我在最近3-4天内就这个问题一直在解决这个问题,但是到目前为止,没有任何设置可以帮助我。非常感谢您的帮助和支持。



谢谢,

Bins



Is anyone can help me to resolve this issue asap as I am sitting on this issue in the last 3-4 days but none the settings is help me till now. I am greatly appreciated your helps and supports.

Thanks,
Bins

推荐答案

1.您是否尝试仅从浏览器访问服务URL?



2.如果你已经尝试过并且它正常工作那么它肯定会对你的服务器配置部分产生问题。让它发挥作用的最基本的事情。我建议请检查您的服务器和客户端配置部分匹配。

- > ReaderQuotas在两端应该是相同的

- >在两端使用的安全机制应该​​是相同的(ClientCredential Type在你的情况下它是windows所以我的建议是请检查你的客户端也只配置了那个)

- >错误请求还建议您在两端的文本编码也不符合指定的条件。请检查一下。
1.have you tried to access your service url from browser only ?

2. if you have tried and it is working properly then it is definately problem with your server configuration section . The most basic thing to get it work. I would suggest please check your server and client configuration section matches.
-> ReaderQuotas should be same at both the end
-> Security mechanism used at both the end should be same(ClientCredential Type in your case it is windows so my advice is please check that your client is also configured with that only)
-> Bad Request also suggest that your encoding of text at both the end is also not matching the specified criteria.please check that also.


谢谢Ashok。



我在浏览器中检查了服务并且它正在运行,但是我没有匹配客户端和服务器配置,因为从SoapUI本身我得到了例外,而且客户端是一个外部团队而我们可能没有有权访问比较结果的设置。



假设我使用较小的xml作为SoapUI的输入参数和VS中的附加进程进行调试,它击中了第一行我的服务代码。如果在SoapUI中没有更大的xml输入参数的情况下没有击中,即;服务本身不会触发。在这种情况下,问题是否在服务器本身内,并且它仍然需要验证客户端配置吗?请纠正我如果我错了并告诉我一个测试这个的解决方案。



谢谢,

箱子
Thanks Ashok.

I checked the service in the browser and it is working, but I didn't matched the client and server configuraitons because from SoapUI itself I am getting the exception and moreover the client is an external team and we may not have access to compare settings from their end.

Suppose I used the smaller xml as input param to SoapUI and Attached Process in VS for debugging, its hitting the first line of my services code. Where as it is not hitting in case of bigger xml input param to SoapUI, ie; the service itself not triggering. In that case is it true that the issue is within server itself and would it still required to verify the client configuration as well??? Please correct me If I am wrong and tell me a solution to test this.

Thanks,
Bins

这篇关于WCF服务失败 - HTTP / 1.1 400错误请求[\ r] [\ n]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆