将 WCF SOAP 和 WCF REST 服务托管为 Azure 应用服务

Hosting WCF SOAP, and WCF REST service as Azure App Services

我正在尝试将现有的 WCF 服务和 WCF REST 服务托管为 Azure 应用服务。我使用了 Visual studio 中的发布选项,就像在 post Here

中一样

我能够浏览到 WCF SOAP 站点和 WCF REST 站点的托管 URL,但是当我为 WCF SOAP 站点添加服务引用并在其上调用方法时,我得到以下结果错误

当我调用 REST 方法时与 WCF 休息服务相同,我得到 404 现在发现错误。

https://wcfservice.azurewebsites.net/WebService.svc 上没有端点侦听可以接受消息。这通常是由不正确的地址或 SOAP 操作引起的。有关详细信息,请参阅 InnerException(如果存在)。 远程服务器返回错误:(404) 未找到。

从失败的请求日志,即 w3svcxxxx 日志,它表示请求 https://WcfService:80/Webservice.svc 404 未找到状态。

对于 WCF 休息服务 https://WcfService:80/RESTservice.svc/GetData 404 未找到状态。

为什么服务在内部调用 https://WcfService:80,这是否需要配置才能设置。试图四处搜索,看看是否能找到任何帮助,但找不到太多。

此外,我还有另一个 WCF 站点已部署到应用程序服务,它是使用 basicHttpBinding 设置的,该站点工作正常,我能够使用它获取数据。

以下是网站上的 web.config 设置,我正在为 WCF SOAP 服务使用 wsHttpBinging

 <system.serviceModel>
<behaviors>
  <serviceBehaviors>
    <behavior name="WebServiceOnline">
      <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
  </serviceBehaviors>
   <endpointBehaviors>
    <behavior name="AjaxBehavior">
      <webHttp />
    </behavior>
  </endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<services>
  <service name="WcfService.WebServiceOnline" behaviorConfiguration="WebServiceOnline">
    <endpoint binding="wsHttpBinding" bindingName="wsSecurityByTransport" contract="WcfService.IWebServiceForOnline" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
  <service name="WcfService.RESTService" behaviorConfiguration="WebServiceOnline">
    <endpoint address="" binding="webHttpBinding" contract="WcfService.IRESTService" name="RunningBarbus.Services.RunningBarbusService" behaviorConfiguration="AjaxBehavior">
      <identity>
        <dns value="locahost" />
      </identity>
    </endpoint>
    <endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
  </service>
</services>
<bindings>
  <wsHttpBinding>
    <binding name="wsSecurityByTransport">
      <security mode="Transport">
        <transport clientCredentialType="None" />
        <message clientCredentialType="Certificate" />
      </security>
    </binding>
  </wsHttpBinding>
</bindings>

<services>   <service name="WcfService.WebServiceOnline" behaviorConfiguration="WebServiceOnline">
    <endpoint binding="wsHttpBinding" bindingName="wsSecurityByTransport" contract="WcfService.IWebServiceForOnline" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />   </service>   <service name="WcfService.RESTService" behaviorConfiguration="WebServiceOnline">
    <endpoint address="" binding="webHttpBinding" contract="WcfService.IRESTService" name="RunningBarbus.Services.RunningBarbusService" behaviorConfiguration="AjaxBehavior">
      <identity>
        <dns value="locahost" />
      </identity>
    </endpoint>
    <endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />   </service> </services>

配置文件中可能存在问题。我们可以为 wshttpbinding 公开额外的服务端点。 这是我的配置,它可以在 Azure 上正常工作。

<system.serviceModel>
    <services>
      <service behaviorConfiguration="mybehavior" name="WcfService1.Service1">
        <!--http, https are all configurated-->
        <endpoint address="" binding="webHttpBinding" contract="WcfService1.IService1" behaviorConfiguration="webbev" bindingConfiguration="mybinding"></endpoint>
        <endpoint address="" binding="webHttpBinding" contract="WcfService1.IService1" behaviorConfiguration="webbev" bindingConfiguration="com"></endpoint>
        <endpoint address="myservice" binding="wsHttpBinding" contract="WcfService1.IService1"></endpoint>
        <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"></endpoint>
      </service>
    </services>
    <bindings>
      <webHttpBinding>
        <binding name="mybinding" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" sendTimeout="00:10:00" receiveTimeout="00:10:00">
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" />
          <security mode="Transport">
            <transport clientCredentialType="None"></transport>
          </security>
        </binding>
        <binding name="com">
          <security mode="None"></security>
        </binding>
      </webHttpBinding>
</bindings>

结果 如果有什么我可以帮忙的,请随时告诉我。