Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net mvc 无法在IIS7中正确承载WCF服务_Asp.net Mvc_Wcf_Visual Studio 2010 - Fatal编程技术网

Asp.net mvc 无法在IIS7中正确承载WCF服务

Asp.net mvc 无法在IIS7中正确承载WCF服务,asp.net-mvc,wcf,visual-studio-2010,Asp.net Mvc,Wcf,Visual Studio 2010,我有一个用.NET4.0编写的WCF服务库。我在同一个解决方案中有一个WCF应用程序(以便在IIS中承载此服务)。它包含WCF库程序集引用和指向库中服务的service.svc文件,以及作为WCF服务库app.config副本的web.config。WCF应用程序设置为在IIS7中承载服务(已设置虚拟目录)。同一个解决方案包含一个ASP.NET Webforms解决方案,我在其中添加了一个指向我在IIS中托管的WCF服务的服务引用(如前所述) 当我启动此ASP.NET Web应用程序的实例时,会

我有一个用.NET4.0编写的WCF服务库。我在同一个解决方案中有一个WCF应用程序(以便在IIS中承载此服务)。它包含WCF库程序集引用和指向库中服务的service.svc文件,以及作为WCF服务库app.config副本的web.config。WCF应用程序设置为在IIS7中承载服务(已设置虚拟目录)。同一个解决方案包含一个ASP.NET Webforms解决方案,我在其中添加了一个指向我在IIS中托管的WCF服务的服务引用(如前所述)

当我启动此ASP.NET Web应用程序的实例时,会收到一条消息,说明“WCF服务已托管”,并且ASP.NET应用程序可以从中正确访问数据。但是,当我尝试通过添加到不同解决方案(指向IIS中托管的服务)中同一台计算机上的MVC 2 Web应用程序的服务引用访问此数据时,我会收到“远程服务器返回错误:(405)方法不允许”。协议异常。但是,如果我手动调用WCF应用程序的实例,MVC应用程序就能够访问服务数据,而我正使用该实例从另一个解决方案托管WCF服务库

我使用VS2010 Beta 2作为我的开发IDE。我已经被这个问题困扰了一段时间了。任何帮助都将不胜感激

我的服务配置如下:-

<system.serviceModel>
<services>
  <service behaviorConfiguration="CruxServices.BasicSearchServiceBehavior"
    name="CruxServices.BasicSearch.BasicSearch">
    <endpoint address="" binding="wsHttpBinding" name="WSBindingEndpoint" bindingConfiguration="WSBindingConfig"
      contract="CruxServices.BasicSearch.Interfaces.IPropertyListFilter">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" name="MexEndpoint"
      contract="IMetadataExchange" />
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost/CruxServices" />
      </baseAddresses>
    </host>
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="CruxServices.BasicSearchServiceBehavior">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
  </serviceBehaviors>
</behaviors>
<bindings>
  <wsHttpBinding>
    <binding name="WSBindingConfig">
      <security mode="None">
        <transport clientCredentialType="None"/>
        <message establishSecurityContext="false"/>
      </security>
    </binding>
  </wsHttpBinding>
</bindings>


在IIS的配置中,指定要使用的.net framework版本

在这种情况下,.net framework有4个版本:1.0、1.1、2.0和4.0

第一个问题是IIS未配置为运行framework 4.0

您可能有一个更大的问题,我不确定是否可能,您可能需要IIS 7.5

编辑


我现在已经检查过了。它将起作用,您需要做的唯一一件事是确保选择framework 4作为应用程序池的框架。

Hi Shiraz,谢谢您的回复。我在Windows7上运行这个程序,它是IIS7.5自带的。我安装了VS2010,因此安装了.NET 4.0,这是一个.NET 4.0 MVC 2应用程序。