Partager via


Calling external Web Services from ASP.NET Application

I tried to build an ASP.NET Application, which uses the Live Search Web Service. I copied the sample code from the SDK (all stuff needed is available at : https://search.live.com/developer ) and pasted it in an ASP.NET Application. But calling the Search Web Service results in the following Error:

The remote name could not be resolved: 'soap.search.live.com'

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Net.WebException: The remote name could not be resolved: 'soap.search.live.com'

In Debug Mode I got an System.ServiceModel.EndpointNotFoundException

{"There was no endpoint listening at https://soap.search.live.com/webservices.asmx that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details."}

The exactly same code worked fine in a console application. After some time I had the the right idea. If you create a new ASP.NET Web Application Visual Studio creates the virtual directory in IIS and an IIS Application, which runs in the DefaultAppPool and if you did not change the user account of this Application Pool it runs under the Builtin Account "Network Services"! This account is not allowed to call anything outside the local machine boundaries, so that was the reason why my Web Service Call to an external services fails.

So I created a new Application Pool that runs under a regular User Account and now the Web Service Call works fine!

There are often little things that make life harder :-)

Best Regards

Martin

Comments

  • Anonymous
    December 07, 2010
    How to create a new Application Pool that runs under a regular User Account??

  • Anonymous
    April 27, 2011
    I am having exact same issue as you described. i changed the account for the app pool running the virtual directory to a more power ful user but still getting Bad request error. any other suggestions?