Div*_*Dan 5 .net asp.net wcf binding
我正在使用WCF4并且无法通过https获得服务
我已经创建了一个wcf服务并部署到服务器,它在http上工作正常.一旦我将web.config端点地址更改为https,我就会收到错误消息
服务'NS.WebWCF.BusinessV1'具有零应用程序(非基础结构)端点.这可能是因为没有为您的应用程序找到配置文件,或者因为在配置文件中找不到与服务名称匹配的服务元素,或者因为在service元素中没有定义端点.
我的web.config看起来像
<services>
<service name="NS.WebWCF.Business_v1">
<endpoint address="https://mydomain.com/business/v1/BusinessV1.svc" binding="basicHttpBinding" bindingConfiguration="" contract="NS.WebWCF.IBusinessV1" listenUri="/" isSystemEndpoint="true">
</endpoint>
</service>
Run Code Online (Sandbox Code Playgroud)
我已将IIS设置为需要SSL.但是我得到了上面的错误.
要使https工作,我需要做什么?
小智 9
试试这个:
<system.serviceModel>
<bindings >
<webHttpBinding>
<binding name="webBinding">
<security mode="Transport">
</security>
</binding>
</webHttpBinding>
</bindings>
<services>
<service ...>
<endpoint bindingConfiguration="webBinding" .../>
</service>
</services>
</system.serviceModel>
Run Code Online (Sandbox Code Playgroud)
您需要为 SSL 设置 IIS 主机标头绑定。旧版本的 IIS 要求从命令行界面进行设置,更高版本通过 GUI 提供此工具。
无论哪种方式,您都可以验证主机标头是否已获取,因为浏览器中的 .SVC 文件生成的 HTML 将会发生变化。
当在绑定正确之前通过 HTTPS:// 访问时,它可能会显示如下内容:
要测试此服务,您需要创建一个客户端并使用它来调用该服务。您可以使用 svcutil.exe 工具从命令行使用以下语法来执行此操作:
svcutil.exe https://AppServerWitHIIS/VirtualDirectory/Your.svc?WSDL
在 IIS 中正确设置绑定后,它将显示:
要测试此服务,您需要创建一个客户端并使用它来调用该服务。您可以使用 svcutil.exe 工具从命令行使用以下语法来执行此操作:
svcutil.exe https://www.yoursslcertsite.com/your.svc?WSDL