关于.net:WCF REST WebInvoke UriTemplate | 珊瑚贝

WCF REST WebInvoke UriTemplate & https Issue


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

1
2
3
4
5
6
7
[OperationContract]
[WebInvoke(Method=”POST”, UriTemplate =”/Function1″)]
void Function1(Stream input);

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

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<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

编辑

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

1
2
3
4
5
6
7
  <webHttpBinding>
    <binding name=”SslBinding” transferMode=”Streamed”>
      <security mode=”None”>
        <transport clientCredentialType=”None” />
      </security>
    </binding>
  </webHttpBinding>

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

  • 您是否在配置中设置了绑定的安全性?
  • 请参阅下面的答案。您可能想尝试将安全模式设置为传输。
  • 我认为你应该听蒂姆的。尝试安全模式=”传输”而不是”无”。此外,您可以设置以”https://”开头的端点地址之一


1
2
3
4
5
6
7
8
<bindings>
  <webHttpBinding>
    <binding name=”SslBinding” transferMode=”Streamed”>
      <security mode=”Transport”>  
        <transport clientCredentialType=”None” />    
    </security>    
  </binding>  
</webHttpBinding>
  • 啊!想我需要阅读更多内容。我将模式设置为无。谢谢!这似乎成功了
  • 我现在可以在本地访问它,但是,当我发布它时,我无法从外部资源访问它:/
  • 你的本地盒子和你发布它的环境有什么不同吗?


来源:https://www.codenong.com/7895392/

微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_9319.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?