【问题标题】:WCF - adding service tag leads to 415 Unsupported Media TypeWCF - 添加服务标签会导致 415 Unsupported Media Type
【发布时间】:2013-09-13 12:42:55
【问题描述】:

我有一个网络服务。我正在使用一个 svc 文件 (WSIntegrationEpis.svc),其内容如下:

<% @ServiceHost Service="XXX.YYY.WSIntegration.EPis.WSEPis" %>

如果我的 web.config 中的 system.serviceModel 中没有任何内容,则 Web 服务可以正常工作。 但是,一旦我尝试添加服务标签,服务器就会开始返回 415 Unsupported Media Type

服务标签的内容:

<services>
  <service name="XXX.YYY.WSIntegration.EPis.WSEPis"  behaviorConfiguration="EPis.WSEPis.DefaultBehavior">
    <endpoint address="" binding="wsHttpBinding" contract="XXX.YYY.WSIntegration.EPis.IWSEPis"/>
  </service>
</services> 

行为部分是标准的:

    <behavior name="EPis.WSEPis.DefaultBehavior">
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
      <serviceMetadata httpGetEnabled="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>

注意事项:

1/如果我重命名服务的名称(所以svc和服务标签中的名称不同),WS开始工作。

2/ 如果我从服务标签中删除了 behaviorConfiguration 属性,它仍然不起作用。

3/ 如果我将bindingConfiguration="WSHttpBinding_IWSEPis" 作为属性添加到服务标签(并且在绑定中我指定了正确的绑定配置),Web 服务仍然无法工作。

我应该改变什么,以便我可以在 web.config 中为我的 web.service 指定参数?

【问题讨论】:

    标签: .net wcf web-services web-config


    【解决方案1】:

    请检查您的服务名称是否与您的类名匹配,区分大小写。

    【讨论】:

      猜你喜欢
      • 2017-08-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-11-16
      • 2014-01-21
      • 2021-07-16
      • 1970-01-01
      相关资源
      最近更新 更多