我成功地将服务引用添加到了我的ASP.NET项目中,但是当我尝试从服务客户端调用方法时,我得到了一个EndpointNotFoundException:
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();这很奇怪,因为我可以通过浏览器访问服务的地址,并且几乎相同的代码可以在另一个项目(Windows窗体)中运行。
谢谢你的帮助。
编辑:
内部异常的消息是The remote name could not be resolved
我尝试请求的服务正在Azure-Cloud中运行。
ASP.NET项目正在我的计算机上本地运行。
我的另一个项目(一切正常)也在我的计算机上本地运行。
也许知道这一点很好,因为我必须在没有Newtonsoft.Json包的情况下创建服务引用。否则,在服务引用的代码生成过程中会出现警告。
发布于 2012-11-21 16:23:35
我在代理后面,也有完全相同的问题。
将此部分添加到我的配置中已为我修复了代理身份验证错误。
<system.net>
<defaultProxy useDefaultCredentials="true" />
</system.net>https://stackoverflow.com/questions/12178398
复制相似问题