How can I setup a .NET 4.0 web service to be available to other machines on my local network?
I have coded a web service using the .Net 4.0 framework and I can successfully invoke it using a test client (SoapUI) on the local machine after publishing the application to my website in IIS. The generated stubs and WSDL are accessible from the local machine and from other machines on the network, however I can not make posts to the WS endpoint from anothe开发者_如何学Cr machine; I can post to the WS endpoint from the local machine and get the expected response. When I try to post to my WS endpoint, I get a HTTP 400 error - "HTTP Error 400. The request is badly formed " in HTML. Is this a problem with my IIS configuration or access permissions on my application files?
Note: Java developer here, in the process of learning .Net.
Edit: I have disabled Windows Firewall and I have the website bindings IP Address set to "All Unassigned" in the IIS Manager.
Edit: Request/Response
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:add="http://mymachinenamewashere/SeflAddressService/AddressService.asmx">
<soapenv:Header/>
<soapenv:Body>
<add:CheckAddress>
<add:chkAddress>
<add:chkCompanyName>XXX</add:chkCompanyName>
<add:chkStreet1>420 Davega Rd.</add:chkStreet1>
<add:chkStreet2/>
<add:chkCity>Lexington</add:chkCity>
<add:chkState>SC</add:chkState>
<add:chkZipcode5>29169</add:chkZipcode5>
<add:chkZipcode4/>
<add:chkSuite/>
</add:chkAddress>
</add:CheckAddress>
</soapenv:Body>
</soapenv:Envelope>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>Bad Request</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Bad Request</h2>
<hr><p>HTTP Error 400. The request is badly formed.</p>
</BODY></HTML>
Possible errors:
- Web service bound to specific IP
- Firewall configuration
- Authentification?
Have you checked the SOAP request and response?
The problem was that my client and SoapUI v2.5 were creating bad requests without the namespaces. I finally figured out where to find the log files and captured some the requests using Wireshark. Upgraded to SoapUI v4.X and it works fine. I am working on modifying my client to include the namespaces (the framework used to generate my client code appears to not be working or is not configured correctly).
精彩评论