添加服务引用WebService失败
下载“http://192.168.1.122:9993/WebService/SendEmailService.asmx/_vti_bin/ListData.svc/$metadata”时出错。
请求失败,显示以下错误消息:
--
<!DOCTYPE html>
<html>
<head>
<title>因 URL 意外地以“/_vti_bin/ListData.svc/$metadata”结束,请求格式无法识别。</title>
<meta name="viewport" content="width=device-width" />
<style>
body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;}
p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
pre {font-family:"Consolas","Lucida Console",Monospace;font-size:11pt;margin:0;padding:0.5em;line-height:14pt}
.marker {font-weight: bold; color: black;text-decoration: none;}
.version {color: gray;}
.error {margin-bottom: 10px;}
.expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }
@media screen and (max-width: 639px) {
pre { width: 440px; overflow: auto; white-space: pre-wrap; word-wrap: break-word; }
}
@media screen and (max-width: 479px) {
pre { width: 280px; }
}
</style>
</head>
<body bgcolor="white">
<span><H1>“/”应用程序中的服务器错误。<hr width=100% size=1 color=silver></H1>
<h2> <i>因 URL 意外地以“/_vti_bin/ListData.svc/$metadata”结束,请求格式无法识别。</i> </h2></span>
<font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">
<b> 说明: </b>执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
<br><br>
<b> 异常详细信息: </b>System.InvalidOperationException: 因 URL 意外地以“/_vti_bin/ListData.svc/$metadata”结束,请求格式无法识别。<br><br>
<b>源错误:</b> <br><br>
<table width=100% bgcolor="#ffffcc">
<tr>
<td>
<code>
执行当前 Web 请求期间生成了未经处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。</code>
</td>
</tr>
</table>
<br>
<b>堆栈跟踪:</b> <br><br>
<table width=100% bgcolor="#ffffcc">
<tr>
<td>
<code><pre>
[InvalidOperationException: 因 URL 意外地以“/_vti_bin/ListData.svc/$metadata”结束,请求格式无法识别。]
System.Web.Services.Protocols.WebServiceHandlerFactory.CoreGetHandler(Type type, HttpContext context, HttpRequest request, HttpResponse response) +694
System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler(HttpContext context, String verb, String url, String filePath) +271
System.Web.Script.Services.ScriptHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated) +81
System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) +271
System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +211
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +157
</pre></code>
</td>
</tr>
</table>
<br>
<hr width=100% size=1 color=silver>
<b>版本信息:</b> Microsoft .NET Framework 版本:4.0.30319; ASP.NET 版本:4.6.1586.0
</font>
</body>
</html>
<!--
[InvalidOperationException]: 因 URL 意外地以“/_vti_bin/ListData.svc/$metadata”结束,请求格式无法识别。
在 System.Web.Services.Protocols.WebServiceHandlerFactory.CoreGetHandler(Type type, HttpContext context, HttpRequest request, HttpResponse response)
在 System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler(HttpContext context, String verb, String url, String filePath)
在 System.Web.Script.Services.ScriptHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated)
在 System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig)
在 System.Web.HttpApplication.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
在 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
-->
--.
元数据包含无法解析的引用:“http://192.168.1.122:9993/WebService/SendEmailService.asmx”。
元数据包含无法解析的引用:“http://192.168.1.122:9993/WebService/SendEmailService.asmx”。
如果该服务已在当前解决方案中定义,请尝试生成该解决方案,然后再次添加服务引用。
window日志
Event code: 3005
Event message: 发生了未经处理的异常。
Event time: 2018/7/13 11:34:25
Event time (UTC): 2018/7/13 3:34:25
Event ID: f06d1db03fbb49358e41f596f788168f
Event sequence: 73
Event occurrence: 5
Event detail code: 0
Application information:
Application domain: /LM/W3SVC/6/ROOT/WebService/WebServiceText-5-131759251600939303
Trust level: Full
Application Virtual Path: /WebService/WebServiceText
Application Path: F:\测试\
Machine name: WIN10S
Process information:
Process ID: 10408
Process name: w3wp.exe
Account name: IIS APPPOOL\Test
Exception information:
Exception type: ArgumentOutOfRangeException
Exception message: 在多字节的目标代码页中,没有此 Unicode 字符可以映射到的字符。 (异常来自 HRESULT:0x80070459)
在 System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
在 System.Web.Hosting.IIS7WorkerRequest.GetServerVariableInternal(String name)
在 System.Web.Hosting.IIS7WorkerRequest.GetServerVariable(String name)
在 System.Web.Hosting.IIS7WorkerRequest.ReadRequestHeaders()
在 System.Web.Hosting.IIS7WorkerRequest.GetKnownRequestHeader(Int32 index)
在 System.Web.HttpRequest.get_ContentType()
在 System.Web.Script.Services.RestHandlerFactory.IsRestMethodCall(HttpRequest request)
在 System.Web.Script.Services.RestHandlerFactory.IsRestRequest(HttpContext context)
在 System.Web.Script.Services.ScriptHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated)
在 System.Web.HttpApplication.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
在 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Request information:
Request URL: http://192.168.1.122:8005/WebService/WebServiceText/WebServiceText.asmx/_vti_bin/ListData.svc/$metadata
Request path: /WebService/WebServiceText/WebServiceText.asmx/_vti_bin/ListData.svc/$metadata
User host address: 192.168.1.122
User:
Is authenticated: False
Authentication Type:
Thread account name: IIS APPPOOL\Test
Thread information:
Thread ID: 19
Thread account name: IIS APPPOOL\Test
Is impersonating: False
Stack trace: 在 System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
在 System.Web.Hosting.IIS7WorkerRequest.GetServerVariableInternal(String name)
在 System.Web.Hosting.IIS7WorkerRequest.GetServerVariable(String name)
在 System.Web.Hosting.IIS7WorkerRequest.ReadRequestHeaders()
在 System.Web.Hosting.IIS7WorkerRequest.GetKnownRequestHeader(Int32 index)
在 System.Web.HttpRequest.get_ContentType()
在 System.Web.Script.Services.RestHandlerFactory.IsRestMethodCall(HttpRequest request)
在 System.Web.Script.Services.RestHandlerFactory.IsRestRequest(HttpContext context)
在 System.Web.Script.Services.ScriptHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated)
在 System.Web.HttpApplication.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
在 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Custom event details:
本地可以添加引用,发布到IIS也可以访问,但是我通过IIS来添加服务引用就出现这种情况。发布到内网的IIS上也可以添加服务引用,难道是我本地的IIS有什么问题吗?