WCF REST WebInvoke UriTemplate 和 WCF REST WebInvoke UriTemplate https 问题

发布于 2024-12-11 18:32:12 字数 1548 浏览 0 评论 0原文

我的 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。同样的问题:(

My WCF service works with WebInvoke attributes and using httpGetEnabled.

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

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

When I try to get it to work with https, I cannot access the UriTemplates. I can however, access the svc and 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>

This service is hosted in IIS 7. Is there something obvious that I'm missing? I've tried as many combinations of configuration as possible. When I try to post to one of the WebInvoke links I get a 404 error.

Another company will be posting to this service, which is why it must be RESTfull

Edit

I did try this in the bindings node:

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

And set the BindingConfiguration on the endpoint. Same issue :(

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

卸妝后依然美 2024-12-18 18:32:12

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

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

Try setting seucrity mode to Transport:

<bindings>
  <webHttpBinding>
    <binding name="SslBinding" transferMode="Streamed">
      <security mode="Transport">  
        <transport clientCredentialType="None" />     
    </security>     
  </binding>   
</webHttpBinding>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文