添加服务引用WebService失败

lzhlovelyb 2018-07-13 12:09:48
下载“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有什么问题吗?
...全文
1340 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
nikolaichow 2018-11-05
  • 打赏
  • 举报
回复
请确保你的[DataContract]格式正确

// 使用下面示例中说明的数据约定将复合类型添加到服务操作。
[DataContract]
public class MetaData
{
[DataMember]
public string number
{
get { return number; }
set { number = value; }
}
}
  • 打赏
  • 举报
回复
你调用代码 看看
lzhlovelyb 2018-07-23
  • 打赏
  • 举报
回复
引用 1 楼 qiaohuyue 的回复:
你 用的是什么 协议类型,去人下 是否有 meta 协议


什么意思?不太了解,能讲清楚吗
XBodhi. 2018-07-23
  • 打赏
  • 举报
回复
http://www.cnblogs.com/faron/articles/4305557.html

参考下这个, 你的问题具体说明下。
XBodhi. 2018-07-13
  • 打赏
  • 举报
回复
你 用的是什么 协议类型,去人下 是否有 meta 协议

12,166

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 Web Services
社区管理员
  • Web Services社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧