Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do I see "HTTP Error 400. The request hostname is invalid." when connected to a wcf service

Tags:

c#

wsdl

wcf

Good day, help me, please understand the situation:

connect to the wcf service is only obtained locally

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

when tested compound from another machine on the LAN i see the error 400

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

i Found information that this may be due to MaxFieldLength and therefore i edited registry as advised here, but it does not alter 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 you stop service the error on the remote computer is changed to

"Web page not available"

The rules of the firewall allows all incoming connections on port 50233.

When connecting to a local address

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

i See the same error 400.

when removing or replacing the "localhost" on IP

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

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

connection becomes not available.

When you add another Binding

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

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

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

failed with code -1073741816 (0xc0000008) 'An invalid handle was specified'.

Windows 8, Visual Studio 2013, use the built-IIS Express, both computers are in the same domain.

like image 833
hwak Avatar asked Jun 16 '14 12:06

hwak


1 Answers

Command execution (as administrator)

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

helped to change a mistake with 400 on 503

Now to see my wsdl, I just added a reference

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

and it start working!

thank you all, it's a wonderful place

like image 173
hwak Avatar answered Oct 16 '22 23:10

hwak