4

我的 WCF 服务使用 WebInvoke 属性并使用 httpGetEnabled。

[OperationContract]
[WebInvoke(Method="POST", UriTemplate = "/Function1")]
void Function1(Stream input);

[OperationContract]
[WebInvoke(Method="POST", UriTemplate = "/Function2")]
void Function2( Stream input );

当我尝试让它与 https 一起使用时,我无法访问 UriTemplates。但是,我可以访问 svc 和 wsdl。

<services>
  <service behaviorConfiguration="SslBehavior" name="MyService">
    <endpoint address="" binding="webHttpBinding" contract="IMyService" behaviorConfiguration="WebBehavior" />
  </service>
</services>

<behaviors>
  <serviceBehaviors>
    <behavior name="SslBehavior">
      <serviceMetadata httpsGetEnabled="True" />
      <serviceDebug includeExceptionDetailInFaults="True"/>
    </behavior>
  </serviceBehaviors>

  <endpointBehaviors>
    <behavior name="WebBehavior">
      <webHttp />
    </behavior>
  </endpointBehaviors>
</behaviors>

该服务托管在 IIS 7 中。我是否缺少明显的东西?我已经尝试了尽可能多的配置组合。当我尝试发布到 WebInvoke 链接之一时,我收到 404 错误。

另一家公司将发布到此服务,这就是为什么它必须是 RESTfull

编辑

我确实在绑定节点中尝试过:

  <webHttpBinding>
    <binding name="SslBinding" transferMode="Streamed">
      <security mode="None">
        <transport clientCredentialType="None" />
      </security>
    </binding>
  </webHttpBinding>

并在端点上设置 BindingConfiguration。同样的问题:(

4

1 回答 1

3

尝试将安全模式设置为传输:

<bindings>
  <webHttpBinding>
    <binding name="SslBinding" transferMode="Streamed">
      <security mode="Transport">  
        <transport clientCredentialType="None" />     
    </security>     
  </binding>   
</webHttpBinding>
于 2011-10-25T20:29:42.653 回答