请问这个是什么原因 怎么调试

dloren_b 2019-05-05 09:47:07
调试wcf的时候出现如下问题 服务主机显示服务已启动 然后测试工具添加服务卡在一半 过一会后出现如下错误:

Error: Cannot obtain Metadata from http://localhost:8733/Design_Time_Addresses/WcfTest/TestService/mex If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address. For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata Exchange Error URI: http://localhost:8733/Design_Time_Addresses/WcfTest/TestService/mex 元数据包含无法解析的引用:“http://localhost:8733/Design_Time_Addresses/WcfTest/TestService/mex”。 请求通道在等待 00:04:59.9531259 以后答复时超时。增加传递给请求调用的超时值,或者增加绑定上的 SendTimeout 值。分配给此操作的时间可能已经是更长超时的一部分。 对“http://localhost:8733/Design_Time_Addresses/WcfTest/TestService/mex”的 HTTP 请求已超过为 00:04:59.9840000 分配的超时。为此操作分配的时间可能是较长超时的一部分。 请求被中止: 操作超时。HTTP GET Error URI: http://localhost:8733/Design_Time_Addresses/WcfTest/TestService/mex 下载“http://localhost:8733/Design_Time_Addresses/WcfTest/TestService/mex”时出错。 请求因 HTTP 状态 400 失败: Bad Request。

请问是什么原因 怎么调试 第一次弄wcf 不太会 非常感谢
...全文
109 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
love_pgme 2019-05-05
  • 打赏
  • 举报
回复
引用 3 楼 dloren_b 的回复:
[quote=引用 2 楼 love_pgme 的回复:] 都说是删除name属性,然后添加serviceMetadata元素
<?xml version="1.0" encoding="utf-8" ?> <configuration> <appSettings> <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" /> </appSettings> <system.web> <compilation debug="true" /> </system.web> <!-- 部署服务库项目时,必须将配置文件的内容添加到 主机的 app.config 文件中。System.Configuration 不支持库的配置文件。 --> <system.serviceModel> <services> <service name="Comewit.Function.DispensingWcfService.TestService"> <host> <baseAddresses> <add baseAddress = "http://localhost:8733/WcfTest/TestService/" /> </baseAddresses> </host> <!-- Service Endpoints --> <!-- 除非完全限定,否则地址相对于上面提供的基址--> <endpoint address="" binding="basicHttpBinding" contract="Comewit.Function.DispensingWcfService.ITestService"> <!-- 部署时,应删除或替换下列标识元素,以反映 用来运行所部署服务的标识。删除之后,WCF 将 自动推断相应标识。 --> <identity> <dns value="localhost"/> </identity> </endpoint> <!-- Metadata Endpoints --> <!-- 元数据交换终结点供相应的服务用于向客户端做自我介绍。 --> <!-- 此终结点不使用安全绑定,应在部署前确保其安全或将其删除--> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> </service> </services> <behaviors> <serviceBehaviors> <behavior> <!-- 为避免泄漏元数据信息, 请在部署前将以下值设置为 false --> <serviceMetadata httpGetEnabled="True" httpsGetEnabled="True"/> <!-- 要接收故障异常详细信息以进行调试, 请将以下值设置为 true。在部署前设置为 false 以避免泄漏异常信息 --> <serviceDebug includeExceptionDetailInFaults="True" /> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel> </configuration> 这是app.config的内容 没有name啊 从新建的wcf服务库移过来的[/quote] 额,抱歉,我只是百度了下,感觉跟你的问题差不多,这个我也不太懂
dloren_b 2019-05-05
  • 打赏
  • 举报
回复
引用 2 楼 love_pgme 的回复:
都说是删除name属性,然后添加serviceMetadata元素
<?xml version="1.0" encoding="utf-8" ?> <configuration> <appSettings> <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" /> </appSettings> <system.web> <compilation debug="true" /> </system.web> <!-- 部署服务库项目时,必须将配置文件的内容添加到 主机的 app.config 文件中。System.Configuration 不支持库的配置文件。 --> <system.serviceModel> <services> <service name="Comewit.Function.DispensingWcfService.TestService"> <host> <baseAddresses> <add baseAddress = "http://localhost:8733/WcfTest/TestService/" /> </baseAddresses> </host> <!-- Service Endpoints --> <!-- 除非完全限定,否则地址相对于上面提供的基址--> <endpoint address="" binding="basicHttpBinding" contract="Comewit.Function.DispensingWcfService.ITestService"> <!-- 部署时,应删除或替换下列标识元素,以反映 用来运行所部署服务的标识。删除之后,WCF 将 自动推断相应标识。 --> <identity> <dns value="localhost"/> </identity> </endpoint> <!-- Metadata Endpoints --> <!-- 元数据交换终结点供相应的服务用于向客户端做自我介绍。 --> <!-- 此终结点不使用安全绑定,应在部署前确保其安全或将其删除--> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> </service> </services> <behaviors> <serviceBehaviors> <behavior> <!-- 为避免泄漏元数据信息, 请在部署前将以下值设置为 false --> <serviceMetadata httpGetEnabled="True" httpsGetEnabled="True"/> <!-- 要接收故障异常详细信息以进行调试, 请将以下值设置为 true。在部署前设置为 false 以避免泄漏异常信息 --> <serviceDebug includeExceptionDetailInFaults="True" /> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel> </configuration> 这是app.config的内容 没有name啊 从新建的wcf服务库移过来的
love_pgme 2019-05-05
  • 打赏
  • 举报
回复
都说是删除name属性,然后添加serviceMetadata元素
love_pgme 2019-05-05
  • 打赏
  • 举报
回复
好像跟这个有点像 http://www.itkeyword.com/doc/9261027859579221x654/wcf-error-cannot-obtain-metadata

12,162

社区成员

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

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