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

问题描述 投票:0回答:1

我试图将现有的WCF服务和WCF REST服务作为Azure应用服务托管。我使用了Visual Studio中的Publish选项,就像在后Here中一样

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

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

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

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

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

为什么服务内部调用https://WcfService:80,这需要配置来设置。试图搜索周围,看看我是否能找到任何帮助,但找不到多少。

此外,我有另一个部署到App Services的WCF站点,它使用basicHttpBinding进行设置,这个站点工作正常,我能够使用它获取数据。

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

 <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>

c# rest azure wcf azure-web-sites
1个回答
1
投票
<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>

结果enter image description here如果有任何我可以提供的帮助,请随时告诉我。

© www.soinside.com 2019 - 2024. All rights reserved.