1

我有一个网络服务。我正在使用一个 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 指定参数?

4

1 回答 1

-2

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

于 2013-12-02T08:10:31.053 回答