在MVC Web应用程序中托管WCF服务

时间:2016-04-21 10:56:44

标签: c# asp.net-mvc wcf https

我在现有的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 个答案:

答案 0 :(得分:0)

  1. 如果您正在使用.Net Frame work 4.5高级服务,请确保“.Net Frame work 4.5高级服务WCF服务选项HTTP激活(需要检查)”下的IIS配置。

  2. 确保web.config中的以下设置如下面的链接所示。

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

    Enable SSL for my WCF service

    HTTPS-enabled, IIS hosted WCF service, How to secure it?

    1. 尝试使用WEB API控制器而不是WCF服务来避免此问题。
相关问题