Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/277.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# EndpointNotFoundException-404-通过VisualStudio在IIS中通过HTTPS托管WCF服务_C#_Asp.net_Wcf_Web Services_Iis - Fatal编程技术网

C# EndpointNotFoundException-404-通过VisualStudio在IIS中通过HTTPS托管WCF服务

C# EndpointNotFoundException-404-通过VisualStudio在IIS中通过HTTPS托管WCF服务,c#,asp.net,wcf,web-services,iis,C#,Asp.net,Wcf,Web Services,Iis,我正在使用传输安全设置开发WCF服务。在测试客户端代理和调用服务方法时,我得到以下EndpointNotFoundException: 在https://MyPC/AMTA.WebService/BroadcastInfoService.svc可以接受该消息。这通常是由不正确的地址或SOAP操作引起的。有关更多详细信息,请参阅InnerException(如果存在) 内部异常: 远程服务器返回错误:(404)未找到 我正在通过VisualStudio托管我的服务 web.config服务: &l

我正在使用传输安全设置开发WCF服务。在测试客户端代理和调用服务方法时,我得到以下
EndpointNotFoundException

https://MyPC/AMTA.WebService/BroadcastInfoService.svc
可以接受该消息。这通常是由不正确的地址或SOAP操作引起的。有关更多详细信息,请参阅InnerException(如果存在)

内部异常:
远程服务器返回错误:(404)未找到

我正在通过VisualStudio托管我的服务

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>
我可以浏览
https://MyPC:443/AMTA.WebService/BroadcastInfoService.svc
点击F5后,显示包含wsdl信息的页面。虽然当我尝试调用客户端代理上的方法时,会抛出端点未找到异常,并显示以下日志详细信息

System.ServiceModel.EndpointNotFoundException,System.ServiceModel,版本=4.0.0.0,区域性=neutral,PublicKeyToken=b77a5c561934e089
服务“/AMTA.WebService/broadcastinginfoservice.svc/”不存在。
StackTrace
位于System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(字符串规范化虚拟路径、事件跟踪活动EventTraceActivity)
在System.ServiceModel.ServiceHostingEnvironment.EnsureServiceAvailableFast(字符串相对虚拟路径、EventTraceActivity EventTraceActivity)


已为IIS启用Https和Http主机头,Https绑定到自签名证书

罪犯失踪了

bindingConfiguration=“TransportSecurity”

来自web.config中的endpoint元素


顺便说一句,您可以通过使用basicHttpsBinding来满足安全性要求,这是.NET4.5的新功能。这将导致更简洁的xml配置。不管怎么说,都是来自魔鬼。

主机和客户端之间的443是开放的吗?主机和客户端是否在同一个框中?尝试以下操作:https:[无空格]//127.0.0.1:443/AMTA.WebService/broadcastinginfoservice.svc是的,所有内容都在同一台计算机上。因此,请尝试Localhost或127.0.0.1,看看是否得到不同的结果。当浏览到客户端配置中的相同地址时会发生什么?你说你浏览到
https://MyPC:443/AMTA.WebService/BroadcastInfoService.svc
在浏览器中运行,但您的客户端配置显示
https://MyPC/AMTA.WebService/BroadcastInfoService.svc
根据您的IIS/IIS Express/Visual Studio网站的配置方式,可能无法解析到同一位置。此外,证书颁发给的主机名是什么?如果证书颁发给
MyPC.Domain.com
localhost
并且您正在浏览
MyPC
我已经重新生成了服务引用,并在新的客户端配置中得到了奇怪的结果:address=“…AMTA.WebService/BroadcastInfoService.svc/BroadcastInfoService.svc”
    <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>
https://MyPC:443/AMTA.WebService/