首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >无法在Visual中调试WCF服务

无法在Visual中调试WCF服务
EN

Stack Overflow用户
提问于 2015-05-07 14:08:24
回答 1查看 1.7K关注 0票数 0

我这里有个问题很烦人..。

我用3个简单的方法创建了一个。该服务在本地、开发服务器和生产服务器上运行良好。

2周后,我被要求添加一些更多的功能,所以我打开了解决方案,并尝试在进行任何更改之前构建/调试服务,以检查它的状态。

不幸的是,在尝试了7-8种不同的解决方案后,我仍然无法调试它,而且我一直在收到相同的错误。

错误:如果这是您可以访问的Windows (R)通信基础服务,则无法从http://localhost:50930/StService.svc获取元数据,请检查是否已启用指定地址的元数据发布。有关启用元数据发布的帮助,请参阅http://go.microsoft.com/fwlink/?LinkId=65455上的MSDN文档。 WS-元数据交换错误URI:http://localhost:50930/StService.svc元数据包含无法解析的引用:“http://localhost:50930/StService.svc”。服务http://localhost:50930/StService.svc不支持Content应用程序/soap+xml;charset=utf-8。 客户端绑定和服务绑定可能不匹配。远程服务器返回一个错误:(415)无法处理消息,因为内容类型'application/soap+xml;charset=utf-8‘不是预期类型'text/xml;charset=utf-8’。 HTTP获取错误URI:http://localhost:50930/StService.svc下载'http://localhost:50930/StService.svc‘时出错。请求失败,HTTP状态400:错误请求。

我试着编辑web.config (虽然在dev和live服务器上除了DB连接是相同的),授予每个临时文件夹、项目文件夹的权限,禁用和删除任何防火墙或防病毒等等。

有什么想法吗?

以下是根据请求提供的web.config:

代码语言:javascript
运行
复制
<?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>
EN

回答 1

Stack Overflow用户

发布于 2015-05-07 15:25:31

<system.serviceModel>标记中添加:

代码语言:javascript
运行
复制
    <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>

我不确定参数。但是,您确实丢失了service-endpoint在App.config上的信息。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30103549

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档