0

I successfully added a service reference to my ASP.NET project, but I get a EndpointNotFoundException, when I try to call a method from a service client:

BenchmarkManagementServiceClient client = new BenchmarkManagementServiceClient();
try {
    int id = Convert.ToInt32(userId);
    if (client.VerifyUser(id)) { //Here is the exception thrown
        FormsAuthentication.SetAuthCookie(userId, false);
    }
} catch (FormatException) { }
client.Close();

Thats curious, because I can access the address of the service via a browser and nearly the same code works in another project (Windows Forms).

Thanks for your help.

Edit:

The message of the inner exception is The remote name could not be resolved

The service I try to request is running in the Azure-Cloud.
The ASP.NET project is running locally on my computer.
My other project (where everything works fine) also runs locally on my computer.

Maybe it's good to know, that I had to create the Service Reference without the package Newtonsoft.Json. Otherwhise occured warnings during the code generation for the service reference.

4

1 回答 1

3

我在代理后面并且遇到了完全相同的问题。

将此部分添加到我的配置中为我修复了代理身份验证错误。

<system.net>
    <defaultProxy useDefaultCredentials="true" />
</system.net>
于 2012-11-21T08:23:35.487 回答