Cor*_*ndt 2 c# asp.net iis wcf web-services
我正在使用传输安全设置开发WCF服务.当测试客户端代理,并调用服务的方法,我得到如下EndpointNotFoundException
:
没有端点监听
https://MyPC/AMTA.WebService/BroadcastInfoService.svc
可以接受该消息.这通常是由错误的地址或SOAP操作引起的.有关更多详细信息,请参阅InnerException(如果存在).内部异常:
远程服务器返回错误:(404)Not Found.
我通过visual studio托管我的服务.
web.config
服务:
<system.serviceModel>
<services>
<service name="AMTA.WebService.Broadcasts.BroadcastInfoService">
<endpoint address="/BroadcastInfoService.svc" binding="wsHttpBinding" contract="AMTA.WebService.Interface.Broadcasts.IBroadcastInfoService"/>
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
</service>
</services>
<bindings>
<wsHttpBinding>
<binding name="TransportSecurity">
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
Run Code Online (Sandbox Code Playgroud)
客户配置:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IBroadcastInfoService">
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="https://MyPC/AMTA.WebService/BroadcastInfoService.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IBroadcastInfoService"
contract="BroadcastInfoService.IBroadcastInfoService" name="WSHttpBinding_IBroadcastInfoService">
</endpoint>
</client>
</system.serviceModel>
Run Code Online (Sandbox Code Playgroud)
我正在使用此虚拟目录将项目的Web属性页面部署到本地IIS:
https://MyPC:443/AMTA.WebService/
Run Code Online (Sandbox Code Playgroud)
我可以https://MyPC:443/AMTA.WebService/BroadcastInfoService.svc
在点击F5后进行浏览,显示带有wsdl信息的页面.虽然当我尝试在客户端代理上调用方法时,会抛出端点未找到异常以及以下日志详细信息
System.ServiceModel.EndpointNotFoundException,System.ServiceModel,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089
服务'/AMTA.WebService/BroadcastInfoService.svc/'不存在. System.ServiceModel.ServiceHostingEnvironment.EnsureServiceAvailble上的
StackTrace
,System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath,EventTraceActivity eventTraceActivity)
,System.ServiceHrace.EnsureServiceAvailableFast(String relativeVirtualPath,EventTraceActivity eventTraceActivity)
为IIS启用了Https和Http主机头,Https与自签名证书相关联.
罪魁祸首不见了
bindingConfiguration = "TransportSecurity"
来自web.config中的endpoint元素.
顺便说一句,只需使用basicHttpsBinding就可以满足安全要求,这是.Net 4.5的新功能.这将导致更简洁的xml配置.无论如何,这都来自魔鬼.
归档时间: |
|
查看次数: |
18497 次 |
最近记录: |