无法在Visual Studio中调试WCF服务
我这里有个问题真的很烦人 我用3个简单的方法创建了一个WCF服务。该服务在开发服务器和生产服务器上的本地运行良好 2周后,我被要求添加更多功能,因此我打开了解决方案,并尝试在进行任何更改之前构建/调试服务,以检查其状态 不幸的是,在尝试了7-8种不同的解决方案后,我仍然无法调试它,而且我一直都会遇到相同的错误 错误:无法从中获取元数据 如果这是您可以访问的Windows(R)通信基础服务,请检查您是否已在指定地址启用元数据发布。 有关启用元数据发布的帮助,请参阅位于的MSDN文档 WS-Metadata交换错误URI: 元数据包含无法解析的引用:“”。 内容类型应用程序/soap+xml;服务不支持字符集=utf-8 客户端和服务绑定可能不匹配。 远程服务器返回错误:(415)无法处理消息,因为内容类型为“application/soap+xml”;charset=utf-8“不是预期的类型”text/xml;字符集=utf-8' HTTP获取错误URI:下载“”时出错。请求失败,HTTP状态为400:请求错误 我试图编辑web.config(尽管在dev和live servers上除了DB连接之外都是相同的),在每个临时文件夹上授予权限,在项目文件夹上,禁用并删除任何防火墙或防病毒软件,等等。无法使其工作 有什么想法吗 以下是根据请求提供的web.config文件:无法在Visual Studio中调试WCF服务,wcf,visual-studio-2013,binding,bad-request,mismatch,Wcf,Visual Studio 2013,Binding,Bad Request,Mismatch,我这里有个问题真的很烦人 我用3个简单的方法创建了一个WCF服务。该服务在开发服务器和生产服务器上的本地运行良好 2周后,我被要求添加更多功能,因此我打开了解决方案,并尝试在进行任何更改之前构建/调试服务,以检查其状态 不幸的是,在尝试了7-8种不同的解决方案后,我仍然无法调试它,而且我一直都会遇到相同的错误 错误:无法从中获取元数据 如果这是您可以访问的Windows(R)通信基础服务,请检查您是否已在指定地址启用元数据发布。 有关启用元数据发布的帮助,请参阅位于的MSDN文档 WS-Meta
<?xml version="1.0"?>
<configuration>
<system.web>
<customErrors mode="Off"/>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5"/>
<caching>
<sqlCacheDependency enabled="true">
<databases>
<add connectionStringName="PhotosSqlServer" name="PhotosSqlServer" pollTime="1000"/>
</databases>
</sqlCacheDependency>
</caching>
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<wsHttpBinding>
<binding name ="wsMessage">
<security mode ="Message">
<message clientCredentialType ="Windows"/>
</security>
</binding>
</wsHttpBinding>
<netTcpBinding>
<binding name="NetTcpBinding_IStService" maxReceivedMessageSize="5242880" maxConnections="10">
<readerQuotas maxDepth="64" maxStringContentLength="5242880" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
<security mode="None"></security>
</binding>
</netTcpBinding>
</bindings>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="false"/>
</system.webServer>
</configuration>
在您的
标签中,添加:
<service name="YourAppNameSpace.StService">
<endpoint address="" binding="wsMessage" bindingConfiguration="NetTcpBinding_IStService"
contract="YourAppNameSpace.IStService" />
<endpoint address="mex" binding="mexHttpBinding" bindingConfiguration=""
contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:50930/StService" />
</baseAddresses>
</host>
</service>
我不确定参数。但是您的App.config上确实缺少
服务端点信息。编译WCF应用程序没有问题吗?如果是这样,在运行WCF测试客户端窗口时是否会弹出窗口?是的,整个解决方案都是无错误构建的。当我启动调试时,会弹出WCF客户端工具,1-2秒后,它会响应错误。您确定此网络地址/端口上没有运行服务吗?请为我们提供WCF应用程序的App.config。我用web编辑了这个问题。config您是否尝试从浏览器调用该服务,并查看真正的问题是什么。同样的错误。但是,我必须指出,它在2周前就已经在使用这个web.config了。