2012-09-05 40 views
3

我在IIS中的网站内创建了一个应用程序。无法停止web.config继承

我的应用程序有没有举办一个WCF服务端点上运行.NET 4.0的代码(它被创建在被运行.NET 2.0的网站)

当我加载该服务端点,我得到一个错误的模型并且缺少处理程序(因为根网站在web.config中定义了它们)。

我试着包装我的System.Web以及system.serviceModel在以下指令:

<location path="." inheritInChildApplications="false"> 
    <system.web> 
    ... 
    </location> 

但处理器和模块继续尝试加载。

接下来,我尝试清除模块和处理程序。

<httpModules> 
    <clear /> 
</httpModules> 
<httpHandlers> 
    <clear /> 
</httpHandlers> 

这导致了以下错误:

No http handler was found for request type 'GET'

下一个我试图手动添加只将必要的处理程序.SVC

 <add 
     verb="*" 
     path="*.svc" 
     type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> 

这导致:

Could not load type 'System.ServiceModel.Activation.HttpHandler' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

在IIS中,我的appl设置为.Net 4.0。我没有看到直接在应用程序池上指定框架的方式(它只有回收,性能,健康,标识选项卡)。

我需要做的是在2.0网站中添加运行.net 4.0的虚拟目录/应用程序,并托管一个WCF端点。

我的4.0应用程序正在单独的应用程序池下运行。

加入整个的web.config

<?xml version="1.0"?> 
<configuration> 
    <location path="." inheritInChildApplications="false"> 
    <system.web> 
     <compilation debug="true" /> 
     <authentication mode="Windows" /> 
     <httpModules> 
     <clear /> 
     </httpModules> 
     <httpHandlers> 
     <clear /> 
     <add verb="*" path="*.svc" 
      type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> 
     </httpHandlers> 
    </system.web> 
    <system.serviceModel> 
     <bindings> 
     <!--<basicHttpBinding> 
     <binding name="extAcctCustMapBinding" maxBufferSize="1000000" 
      maxReceivedMessageSize="1000000" /> 
     </basicHttpBinding>--> 
     </bindings> 

     <behaviors> 
     <serviceBehaviors> 
      <behavior name="DebugBehavior"> 
      <serviceMetadata httpGetEnabled="true" /> 
      <serviceDebug includeExceptionDetailInFaults="true" /> 
      </behavior> 
     </serviceBehaviors> 
     </behaviors> 

     <services> 
     <service behaviorConfiguration="DebugBehavior" name="MyService"> 
      <endpoint binding="basicHttpBinding" name="MyService" 
      contract="IMyService" /> 
     </service> 
     </services> 

     <serviceHostingEnvironment multipleSiteBindingsEnabled="false" /> 
    </system.serviceModel> 

    <system.webServer> 
     <modules runAllManagedModulesForAllRequests="false"/> 
    </system.webServer> 
    </location> 
</configuration> 

回答

1

你不能有.NET 4.0上运行的.NET 2.0应用程序中的嵌套应用。

+0

嗯..至少IIS不阻止我创建它..所以我想我可以使它工作?我的意思是,如果我使用不同的应用程序池? –

+0

我看到你的编辑。您对IIS使用集成或经典模式吗? –

0

.NET框架版本是在应用程序级别定义的。您可以将网站(www.example.com)作为.NET 2.0应用程序运行,然后将.NET虚拟目录(即主站点下的独立应用程序)设置为.NET 4.0应用程序。应用程序池不能共享不同的.NET版本,因此每个应用程序需要单独的应用程序池,但这与站点配置无关。尽管如此,如果您将主站点配置为.NET 2.0应用程序并将虚拟目录配置为.NET 4.0应用程序,则.NET 4.0应用程序无法继承.NET 2.0应用程序的配置。配置模式不向后兼容。

+0

所有这一切都是真实的(虚拟目录是在不同的应用程序池下运行的应用程序),但它正在继承它。 –

+0

我想你需要发布你的父母和孩子配置的整个相关部分,并发布确切的错误。有些东西似乎相冲突。 – Chris

+0

添加整个配置 –