簡體   English   中英

在MVC Web應用程序中托管WCF服務

[英]Hosted WCF service inside MVC Web application

我在現有的MVC Web應用程序中添加了一個WCF服務,以便在OLAP多維數據集工具( Syncfusion )上顯示它。 當我使用啟用http的站點執行應用程序時會發生什么,我能夠訪問如下的WCF方法,

$("#OlapClient").ejOlapClient({ url: "/Areas/OLAP/wcf/OlapClientService.svc"});

但是,當我從啟用https站點執行此操作時,我無法訪問WCF方法。 它只是拋出404 method not found exception 以下是我的WCF的web.config。

Web.config文件

<system.serviceModel>
 <behaviors>
  <endpointBehaviors>

    <behavior name="OLAP.wcf.OlapClientServiceAspNetAjaxBehavior">
      <enableWebScript />
    </behavior>
  </endpointBehaviors>
  <serviceBehaviors>
    <behavior name="">
      <serviceMetadata httpsGetEnabled="false" />
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>
  </serviceBehaviors>

</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<services>

  <service name="OLAP.wcf.OlapClientService">
    <endpoint address="" behaviorConfiguration="OLAP.wcf.OlapClientServiceAspNetAjaxBehavior" binding="webHttpBinding" contract="OLAP.wcf.IOlapClientService">

    </endpoint>
  </service>
</services>
<bindings>
  <basicHttpBinding>
    <binding name="BasicHttpBinding_IService1" />
  </basicHttpBinding>
</bindings>
<client>
  <endpoint address="http://localhost:15415/VibrantWS.svc/soap"
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService1"
    contract="ServiceReference1.IService1" name="BasicHttpBinding_IService1" />
</client>
</system.serviceModel>
  1. 如果您正在使用.Net Frame work 4.5高級服務,請確保在“.Net Frame work 4.5高級服務WCF服務選項HTTP激活(需要檢查)”下的IIS配置。

  2. 確保web.config中的以下設置如下面的鏈接所示。

https://msdn.microsoft.com/en-us/library/hh556232(v=vs.110).aspx

為我的WCF服務啟用SSL

啟用HTTPS,IIS托管的WCF服務,如何保護它?

  1. 嘗試使用WEB API控制器而不是WCF服務來避免此問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM