简体   繁体   中英

web service IIS7 .net framework 4 http 400

On our test server, when I try to go to the URL of a WCF service hosted in IIS, I get an HTTP 400 error. When I look at the WCF log on the server, it states "The body of the message cannot be read becaue it is empty". If I try doing the same thing for another service on the same server, it works fine and I get the path for the WSDL.

I am not able to connect to the WSDL through SoapUI either. However, I am able to connect to the service from Visual Studio.

Most posts I have seen mention needing httpGetEnabled="true" in the config file. That property is present in the web.config of the test server.

Other posts mention needing additional properties but I don't understand why they would be needed if the production server works without them.

EDIT in response to Davin: Here is the raw view from Fiddler for the production request GET http://production.svc HTTP/1.1 Accept: text/html, application/xhtml+xml, / Accept-Language: en-US User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0) Accept-Encoding: gzip, deflate Connection: Keep-Alive Host: production

and this is the raw view from Fiddler for the test request GET http://test.svc HTTP/1.1 Accept: text/html, application/xhtml+xml, / Accept-Language: en-US User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0) Accept-Encoding: gzip, deflate Connection: Keep-Alive Host: test

This was trying to use IE9 to connect to the service.

To CodeCaster: It is using framework 4 and running in the asp.net v4.0 app pool. Framework 4 is installed on the server. If I use a test application I set up, I am able to connect to the service and send a request to one of the methods and it works fine.

My issue is connecting to the service with IE or soapUI as our vendor won't update their endpoints on their test system until they are able to do so.

HTTP 400 is a BadRequest . This is thrown when the server is rejecting the request because it cannot process it. The error message you are receiving makes sense in this context. This also means that the server is able to find your endpoint. So, the problem is probably not with httpGetEnabled .

What you need to do is see the HTTP message that is going to the server. For this, I suggest pointing your client at a proxy (fiddler) and then configuring fiddler to forward on the request to the server. Then you need to make sure that the request is in the format that you expect.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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