visual web developer Web service on debug HTTP/1.1 400 Bad Request
Asked Answered
S

2

5

I have an .net c# mvc3 web service application developed wirh visual web developer 2010. I am calling the web services from an android movile application. I want to test the web services, from the eclipse emulator. When i debug the webservice application everything works fine by calling the services from the web browser but when i call then from the android application using the emulator y get "HTTP/1.1 400 Bad Request".

the curious thing is that if i publish the web service application on my local IIS 7 everything wirks fine although i can not debug the service.

when i debig the service using the visual web developer a web page appear with a adress like that:

"http://localhost:1627/myservice.asmx/myMethod"

On my android application i call the service with a url like that:

"http://10.0.2.2:1627/myservice.asmx/myMethod"

but then i get the "HTTP/1.1 400 Bad Request"

I really would appreciate any help.

thanks.

Saxen answered 31/7, 2012 at 12:34 Comment(0)
C
3

According to Cannot connect ASP.NET development server (VS2010) via IP address

The ASP.NET Development Server will serve pages to browser requests on the local computer. It will not serve pages to another computer. Additionally, it will not serve files that are outside of the application scope. The ASP.NET Development Server provides an efficient way to test pages locally before you publish the pages to a production server running IIS.

Corniculate answered 3/12, 2012 at 8:9 Comment(0)
C
3

For Visual Studio 2010 I always used inetd which is a port forwarding tool. Since Visual Studio 2012 I have this problem as well. The problem is that only localhost calls are allowed in the development server, even proxy calls don't work unless you change the request headers. I have made some modifications to an existing simple proxy server which I found on GitHub. It changes the IP address in the request url to`localhost. Download the code here.


I found a better solution. When you have IIS Express installed on your computer create a new application in IIS of the directory of your project and give it an alias. Note the right application pool is set and you will be able to browse your site via http://localhost/YourProject/ When you cannot connect from other computers it's probably a firewall problem.

Crate answered 3/12, 2012 at 10:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.