Why I see "HTTP Error 400. Request host name is invalid." when connecting to wcf service

Good afternoon, help me, please understand the situation:

connection to wcf service is obtained only locally

http://localhost:50233/Service1.svc?wsdl 

when testing a connection from another computer on the local network, I see an error 400

 http://computer:50233/Service1.svc?wsdl 

i Found information that this could be related to MaxFieldLength, and therefore I edited the registry as indicated here, but it does not change the result.

 C: \ Users \ user> ping computer Pinging 192.168.0.11 with 32 bytes of data: Reply from 192.168.0.11: bytes = 32 time <1ms TTL = 127 Reply from 192.168.0.11: bytes = 32 time <1ms TTL = 127 Reply from 192.168.0.11: bytes = 32 time <1ms TTL = 127 Reply from 192.168.0.11: bytes = 32 time <1ms TTL = 127 Ping statistics for 192.168.0.11: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 0ms, Average = 0ms 

When the service stops, the error on the remote computer changes to

 "Web page not available" 

Firewall rules allow all inbound connections on port 50233.

When connecting to a local address

 http://computer:50233/Service1.svc?wsdl 

i See the same error 400.

when deleting or replacing "localhost" with IP

 <binding protocol="http" bindingInformation="*:50233:localhost" /> 

File \ My Documents \ IISExpress \ config \ applicationhost.config

connection becomes unavailable.

When you add another binding

 <Binding Protocol="http" bindingInformation="*:50233:localhost" /> <Binding Protocol="http" bindingInformation="*:50233:192.168.0.11" /> 

when trying to start cursing Program "[9632] iisexpress.exe"

failed with code -1073741816 (0xc0000008) "Invalid handle specified."

Windows 8, Visual Studio 2013, uses the integrated IIS Express, both computers are in the same domain.

+8
c # wsdl wcf
source share
2 answers

Command execution (as administrator)

 netsh http add urlacl url=http://computer:50233/ user=Everyone 

helped change the error from 400 to 503

Now, to see my wsdl, I just added a link

 <Binding Protocol="http" bindingInformation="*:50233:computer" /> <Binding Protocol="http" bindingInformation="*:50233:192.168.0.11" /> <Binding Protocol="http" bindingInformation="*:50233:localhost" /> 

and he starts to work!

Thanks everyone, this is a wonderful place.

+13
source

You can do this very easily without configuration changes using our free VS extension called Conveyor.

Use Tools-> Extensions ... to get it, or at https://marketplace.visualstudio.com/items?itemName=vs-publisher-1448185.ConveyorbyKeyoti

0
source

All Articles