问题在IIS中运行的应用程序MVC3 7 [英] Problem running MVC3 app in IIS 7

查看:123
本文介绍了问题在IIS中运行的应用程序MVC3 7的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有获得运行Windows 7家庭,64位的计算机上的IIS7一个MVC 3项目的运行问题。下面是我做的。


  1. 安装了IIS 7。

  2. 访问的服务器,并得到了IIS欢迎页面。

  3. 创建一个名为ð目录:\\ mysite的和复制的MVC应用它。 (MVC的应用就是当你在Visual Studio中的一个新的MVC3项目创建的标准应用程序,它只是显示一个主页和一个账户登录页面。它运行Visual Studio开发服务器中正常,我也复制出来我的托管网站,它工作正常那里)

  4. 启动IIS管理控制台。

  5. 停止默认的站点。

  6. 添加了一个名为mysite的同一个物理目录新网站D:\\ MYSITE

  7. 改变命名的MySite使用.Net框架4.0的应用程序池,综合管线

当我在浏览器访问该网站,我得到了D文件的列表:\\ mysite的目录。这是因为如果IIS不能识别D的内容:\\ mysite的是MVC应用程序

什么是我需要做来解决这个?

按照要求,这里是web.config中:

 <?XML版本=1.0&GT?;
<! -
  有关如何配置ASP.NET应用程序的更多信息,请访问:
  http://go.microsoft.com/fwlink/?LinkId=152368
   - ><结构>
  <&是connectionStrings GT;
    <添加名称=ApplicationServices
         的connectionString =数据源= \\ SQLEX $ P $干燥综合征;集成安全性= SSPI; AttachDBFilename = | DataDirectory目录| ASPNETDB.MDF;用户实例=真
         的providerName =System.Data.SqlClient的/>
  < /&是connectionStrings GT;  <&的appSettings GT;
    <添加键=ClientValidationEnabledVALUE =真/>
    <添加键=UnobtrusiveJavaScriptEnabledVALUE =真/>
  < /的appSettings>  <&的System.Web GT;
    <编译调试=真targetFramework =4.0>
      <&集会GT;
        <添加组件=System.Web.Abstractions,版本= 4.0.0.0,文化=中性公钥= 31BF3856AD364E35/>
        <添加组件=System.Web.Helpers,版本= 1.0.0.0,文化=中性公钥= 31BF3856AD364E35/>
        <添加组件=System.Web.Routing,版本= 4.0.0.0,文化=中性公钥= 31BF3856AD364E35/>
        <添加组件=System.Web.Mvc,版本= 3.0.0.0,文化=中性公钥= 31BF3856AD364E35/>
        <添加组件=System.Web.WebPages,版本= 1.0.0.0,文化=中性公钥= 31BF3856AD364E35/>
      < /组件>
    < /编译>    <身份验证模式=表格>
      <形式loginUrl =〜/帐号/登录超时=2880/>
    < /认证>    <会员和GT;
      <供应商>
        <清/>
        <添加名称=AspNetSqlMembershipProviderTYPE =System.Web.Security.SqlMembershipProvider的connectionStringName =ApplicationServices
             enablePasswordRetrieval =假enablePasswordReset设置=真requiresQuestionAndAnswer =假requiresUniqueEmail =假
             maxInvalidPasswordAttempts =5minRequiredPasswordLength =6minRequiredNonalphanumericCharacters =0passwordAttemptWindow =10
             的applicationName =//>
      < /供应商>
    < /会员>    <型材>
      <供应商>
        <清/>
        <添加名称=AspNetSqlProfileProviderTYPE =System.Web.Profile.SqlProfileProvider的connectionStringName =ApplicationServices的applicationName =//>
      < /供应商>
    < / profile文件>    < roleManager启用=false的>
      <供应商>
        <清/>
        <添加名称=AspNetSqlRoleProviderTYPE =System.Web.Security.SqlRoleProvider的connectionStringName =ApplicationServices的applicationName =//>
        <添加名称=AspNetWindowsTokenRoleProviderTYPE =System.Web.Security.WindowsTokenRoleProvider的applicationName =//>
      < /供应商>
    < / roleManager>    <网页和GT;
      <&命名空间GT;
        <添加命名空间=System.Web.Helpers/>
        <添加命名空间=System.Web.Mvc/>
        <添加命名空间=System.Web.Mvc.Ajax/>
        <添加命名空间=System.Web.Mvc.Html/>
        <添加命名空间=System.Web.Routing/>
        <添加命名空间=System.Web.WebPages/>
      < /命名空间>
    < /页>
  < /system.web>  < system.webServer>
    <验证validateIntegratedModeConfiguration =FALSE/>
    <模块runAllManagedModulesForAllRequests =真/>
  < /system.webServer>  <&运行GT;
    < assemblyBinding的xmlns =瓮:架构 - 微软COM:asm.v1>
      < dependentAssembly>
        < assemblyIdentity名称=System.Web.Mvc公钥=31bf3856ad364e35/>
        < bindingRedirect oldVersion =1.0.0.0-2.0.0.0NEWVERSION =3.0.0.0/>
      < / dependentAssembly>
    < / assemblyBinding>
  < /运行>
< /结构>


解决方案

我张贴了这个问题的ServerFault,以及,并得到了解决这一问题的这里

答案是:

由于IIS是.NET 4安装后,你可能需要运行 ASPNET_REGIIS.EXE 工具与IIS注册所有.NET 4的东西。

I am having a problem getting a MVC 3 project running in IIS7 on a computer running Windows 7 Home-64 bit. Here is what I did.

  1. Installed IIS 7.
  2. Accessed the server and got the IIS welcome page.
  3. Created a directory named d:\MySite and copied the MVC application to it. (The MVC app is just the standard app that is created when you create a new MVC3 project in visual studio. It just displays a home page and an account logon page. It runs fine inside the Visual Studio development server and I also copied it out to my hosting site and it works fine there)
  4. Started IIS management console.
  5. Stopped the default site.
  6. Added a new site named "MySite" with a physical directory of "d:\Mysite"
  7. Changed the application pool named MySite to use .Net Framework 4.0, Integrated pipeline

When I access the site in the browser I get a list of the files in the d:\MySite directory. It is as if IIS is not recognizing the contents of d:\MySite as an MVC application.

What do I need to do to resolve this?

As requested, here is the web.config:

    <?xml version="1.0"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=152368
  -->

<configuration>
  <connectionStrings>
    <add name="ApplicationServices"
         connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true"
         providerName="System.Data.SqlClient" />
  </connectionStrings>

  <appSettings>
    <add key="ClientValidationEnabled" value="true"/> 
    <add key="UnobtrusiveJavaScriptEnabled" value="true"/> 
  </appSettings>

  <system.web>
    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      </assemblies>
    </compilation>

    <authentication mode="Forms">
      <forms loginUrl="~/Account/LogOn" timeout="2880" />
    </authentication>

    <membership>
      <providers>
        <clear/>
        <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices"
             enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false"
             maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10"
             applicationName="/" />
      </providers>
    </membership>

    <profile>
      <providers>
        <clear/>
        <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/" />
      </providers>
    </profile>

    <roleManager enabled="false">
      <providers>
        <clear/>
        <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" />
        <add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" />
      </providers>
    </roleManager>

    <pages>
      <namespaces>
        <add namespace="System.Web.Helpers" />
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Routing" />
        <add namespace="System.Web.WebPages"/>
      </namespaces>
    </pages>
  </system.web>

  <system.webServer>
    <validation validateIntegratedModeConfiguration="false"/>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>

  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

解决方案

I posted this question on "ServerFault" as well and got a resolution to the issue here.

The answer is:

Since IIS was installed after .NET 4, you likely need to run the aspnet_regiis.exe tool to register all the .NET 4 stuff with IIS.

这篇关于问题在IIS中运行的应用程序MVC3 7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆