c# – 使用wsHttpBinding配置WCF服务
我在使用
wsHttpBinding 和Https基地址设置WCF服务时遇到问题.
真正的问题是在客户端测试WCF中定义mex时: 错误:无法从中获取元数据 App.config: <system.serviceModel> <behaviors> <serviceBehaviors> <behavior name="NewBehavior0"> <!-- Error: Cannot optain metadata --> <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="true" /> </behavior> <behavior name="NewBehavior1"> <!-- Error: Cannot Find Cert --> <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="true" /> <serviceCredentials> <serviceCertificate findValue="BadThumbprint" x509FindType="FindByThumbprint" storeLocation="LocalMachine" storeName="My"/> </serviceCredentials> </behavior> <behavior name="NewBehavior2"> <!-- Error: Cannot optain metadata --> <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="true" /> <serviceCredentials> <serviceCertificate findValue="GoodThumbprint" x509FindType="FindByThumbprint" storeLocation="LocalMachine" storeName="My"/> </serviceCredentials> </behavior> </serviceBehaviors> </behaviors> <bindings> <wsHttpBinding> <binding name="wsHTTPBindingConf"> <security mode="Transport"> <!--<message clientCredentialType="None" />--> </security> </binding> </wsHttpBinding> </bindings> <services> <service behaviorConfiguration="NewBehavior0" name="_20180420_WcfServiceLibraryTest.Service1"> <endpoint address="" binding="wsHttpBinding" bindingConfiguration="wsHTTPBindingConf" name="WCFEndpoint" contract="_20180420_WcfServiceLibraryTest.IService1"> <identity> <dns value="localhost" /> </identity> </endpoint> <endpoint address="mex" binding="mexHttpsBinding" bindingConfiguration="" name="mexEndPoint" contract="IMetadataExchange" /> <host> <baseAddresses> <add baseAddress="https://localhost:8722/Design_Time_Addresses/_20180420_WcfServiceLibraryTest/Service1/" /> </baseAddresses> </host> </service> </services> </system.serviceModel> 阅读SO并尝试我发现的每件事我尝试了很多配置.但没有一个显示出值得一提的进步.看起来更像,我不知道. 解决方法
我想这可能是因为mex bindingConfiguration =“”被设置为一个空字符串?
尝试删除它,或将其设置为绑定. 如果默认的mexHttpBinding不起作用,请尝试将其更改为wsHttpBinding.这是一个可能有用的示例Custom Secure Metadata Endpoint.它说:
需要为不同的绑定配置WCF测试客户端,但我认为它会自动配置自己. <services> <service name="Microsoft.ServiceModel.Samples.CalculatorService" behaviorConfiguration="CalculatorServiceBehavior"> <!-- use base address provided by host --> <endpoint address="" binding="wsHttpBinding" bindingConfiguration="Binding2" contract="Microsoft.ServiceModel.Samples.ICalculator" /> <endpoint address="mex" binding="wsHttpBinding" bindingConfiguration="Binding1" contract="IMetadataExchange" /> </service> </services> <bindings> <wsHttpBinding> <binding name="Binding1"> <security mode="Message"> <message clientCredentialType="Certificate" /> </security> </binding> <binding name="Binding2"> <reliableSession inactivityTimeout="00:01:00" enabled="true" /> <security mode="Message"> <message clientCredentialType="Certificate" /> </security> </binding> </wsHttpBinding> </bindings> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- c# – 由于布局影响,打开WPF窗口很慢
- vue项目实现记住密码到cookie功能示例(附源码)
- React -- 事件系统
- c# – Linq to Entities Skip()和Take()
- 解决vue单页使用keep-alive页面返回不刷新的问题
- React Virtual DOM Explained in Simple English
- swift – 无法将’Character’类型的值转换为强制类型’Str
- c – 类中的易失性变量:“在’volatile’之前预期的nonqua
- c# – 使用VID和PID识别连接到x64的USB设备的COM端口
- 正则表达式 – 确定两种语言是否相等[正则表达式]