我成功添加一個服務引用到我的ASP.NET項目時,但我得到一個EndpointNotFoundException
,當我嘗試從服務客戶端調用一個方法: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的雲上運行。
ASP.NET項目在我的電腦上本地運行。
我的其他項目(一切工作正常)也在我的電腦上本地運行。
也許很高興知道,我必須創建服務引用,而不需要包Newtonsoft.Json
。其他人在代碼生成過程中發現了服務引用的警告。
可能是防火牆/防病毒問題。 –
我不這麼認爲,因爲它適用於我的其他項目。我的ASP.NET項目在同一臺機器上本地測試 – Lennart
http://stackoverflow.com/a/2288243/1262700可能會幫助你。 –