简体   繁体   English

将WCF SOAP和WCF REST服务托管为Azure App Services

[英]Hosting WCF SOAP, and WCF REST service as Azure App Services

I am trying to host existing WCF service and a WCF REST service as a Azure App Services. 我正在尝试将现有的WCF服务和WCF REST服务作为Azure App Services托管。 I have used the Publish option from Visual studio like in the post Here 我在使用后从Visual Studio中的发布选项喜欢这里

I am able to browse to the hosted URL for the WCF SOAP site and the WCF REST site, but when i add a service reference for the WCF SOAP site and call a method on it i get below error 我能够浏览到WCF SOAP站点和WCF REST站点的托管URL,但是当我为WCF SOAP站点添加服务引用并对其调用方法时,出现以下错误

Same with the WCF rest service when i call a REST method, i get 404 now found error. 当我调用REST方法时,与WCF Rest服务相同,我现在得到404错误。

There was no endpoint listening at https://wcfservice.azurewebsites.net/WebService.svc that could accept the message. https://wcfservice.azurewebsites.net/WebService.svc上没有侦听终结点的端点可以接受该消息。 This is often caused by an incorrect address or SOAP action. 这通常是由不正确的地址或SOAP操作引起的。 See InnerException, if present, for more details. 有关更多详细信息,请参见InnerException(如果存在)。 The remote server returned an error: (404) Not Found. 远程服务器返回错误:(404)找不到。

From the failed request log ie w3svcxxxx log, it says the request https://WcfService:80/Webservice.svc 404 not found status. 从失败的请求日志(即w3svcxxxx日志)中,它显示请求https:// WcfService:80 / Webservice.svc 404找不到状态。

For the WCF Rest Service https://WcfService:80/RESTservice.svc/GetData 404 not found status. 对于WCF休息服务https:// WcfService:80 / RESTservice.svc / GetData 404找不到状态。

Why is the service internally calling a https://WcfService:80 , would this require an configuration to setup. 为什么服务在内部调用https:// WcfService:80 ,这将需要配置进行设置。 Tried to search around to see if i could find any help around this but could not find much. 试图四处搜索,看看我是否可以在这方面找到任何帮助,但找不到太多。

Also, i have another WCF site that i had deployed to the App Services, which is setup with a basicHttpBinding and this site worked fine and i was able to get data using it. 另外,我还有另一个WCF站点,我已将其部署到App Services,该站点使用basicHttpBinding设置,并且此站点运行良好,并且能够使用它获取数据。

Below is the web.config setting on the web site, i am using wsHttpBinging for the WCF SOAP service 以下是网站上的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>

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

There may be an issue in the configuration file. 配置文件中可能存在问题。 We could expose the additional service endpoint for wshttpbinding. 我们可以为wshttpbinding公开其他服务端点。 Here is my configuration, and it works properly over Azure. 这是我的配置,它可以在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>

Result 结果 在此处输入图片说明 Feel free to let me know if there is anything I can help with. 请随时告诉我是否有什么我可以帮助的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM