在IIS 7部署ASP.Net MVC应用程序4 [英] Deploying ASP.Net MVC 4 App on IIS 7

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

问题描述

我创建了一个简单的应用程序并运行它的视觉工作室。
然后我去项目属性>网络,并改成了使用本地IIS服务器。

现在,当我调试,我看不到任何东西,甚至本地主机\\ mysite的\\首页将返回404。
它看起来像IIS正在寻找一个叫做网站主文件夹下的文件夹\\家里,而不是寻找一个名为home控制器。

IIS有我的应用程序与网站应用程序池默认ASP.Net,集成模式。

什么是错的?

我的配置是标准的向导:

 <?XML版本=1.0编码=UTF-8&GT?;
<! -
  有关如何配置ASP.NET应用程序的更多信息,请访问:
  http://go.microsoft.com/fwlink/?LinkId=169433
   - >
<结构>
  < configSections>
    <! - 有关Entity Framework的配置的详细信息,请访问http://go.microsoft.com/fwlink/?LinkID=237468 - >
    <节名称=的EntityFrameworkTYPE =System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection,的EntityFramework,版本5.0.0.0 =文化=中性公钥= b77a5c561934e089requirePermission =FALSE/>
  < / configSections>
  <&是connectionStrings GT;
   !< - <添加名称=DefaultConnection的connectionString =数据源=(的LocalDB)\\ V11.0;初始目录= ASPNET-MvcApplication2-20130718122501;集成安全性= SSPI; AttachDBFilename = | DataDirectory目录| \\ ASPNET,MvcApplication2 -20130718122501.mdf的providerName =System.Data.SqlClient的/> - >
    <添加名称=DefaultConnection的connectionString =数据Source=.\\SQLEX$p$pSS;AttachDbFilename=|DataDirectory|\\aspnet-MvcApplication2-20130718122501.mdf;Initial目录= ASPNET-MvcApplication2-20130718122501;集成安全性=真;用户实例=真的providerName =System.Data.SqlClient的/>
  < /&是connectionStrings GT;
  <&的appSettings GT;
    <添加键=网页:版本值=2.0.0.0/>
    <添加键=网页:启用VALUE =FALSE/>
    <添加关键=preserveLoginUrlVALUE =真/>
    <添加键=ClientValidationEnabledVALUE =真/>
    <添加键=UnobtrusiveJavaScriptEnabledVALUE =真/>
  < /的appSettings>
  <&的System.Web GT;
    <编译调试=真targetFramework =4.5/>
    <的httpRuntime targetFramework =4.5/>
    <身份验证模式=表格>
      <形式loginUrl =〜/帐号/登录超时=2880/>
    < /认证>
    <网页和GT;
      <&命名空间GT;
        <添加命名空间=System.Web.Helpers/>
        <添加命名空间=System.Web.Mvc/>
        <添加命名空间=System.Web.Mvc.Ajax/>
        <添加命名空间=System.Web.Mvc.Html/>
        <添加命名空间=System.Web.Optimization/>
        <添加命名空间=System.Web.Routing/>
        <添加命名空间=System.Web.WebPages/>
      < /命名空间>
    < /页>
  < /system.web>
  < system.webServer>
    <验证validateIntegratedModeConfiguration =FALSE/>
  <&处理GT;
    <清除NAME =ExtensionlessUrlHandler-ISAPI-4.0_32bit/>
    <清除NAME =ExtensionlessUrlHandler-ISAPI-4.0_64bit/>
    <清除NAME =ExtensionlessUrlHandler - 集成 - 4.0/>
    <添加名称=ExtensionlessUrlHandler-ISAPI-4.0_32bitPATH =*。动词=GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS模块=IsapiModulescriptProcessor ​​=%WINDIR%\\ Microsoft.NET \\框架\\ v4.0.30319 \\ ASPNET_ISAPI.DLLpreCondition = classicMode,runtimeVersionv4.0,bitness32responseBufferLimit =0/>
    <添加名称=ExtensionlessUrlHandler-ISAPI-4.0_64bitPATH =*。动词=GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS模块=IsapiModulescriptProcessor ​​=%WINDIR%\\ Microsoft.NET \\ Framework64 \\ v4.0.30319 \\ ASPNET_ISAPI.DLLpreCondition = classicMode,runtimeVersionv4.0,bitness64responseBufferLimit =0/>
    <添加名称=ExtensionlessUrlHandler - 集成 - 4.0PATH =*。动词=GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONSTYPE =System.Web.Handlers.TransferRequestHandlerpreCondition =integratedMode,runtimeVersionv4.0/>< /处理器> < /system.webServer>
  <&运行GT;
    < assemblyBinding的xmlns =瓮:架构 - 微软COM:asm.v1>
      < dependentAssembly>
        < assemblyIdentity名称=DotNetOpenAuth.Core公钥=2780ccd10d57b246/>
        < bindingRedirect oldVersion =1.0.0.0-4.0.0.0NEWVERSION =4.1.0.0/>
      < / dependentAssembly>
      < dependentAssembly>
        < assemblyIdentity名称=DotNetOpenAuth.AspNet公钥=2780ccd10d57b246/>
        < bindingRedirect oldVersion =1.0.0.0-4.0.0.0NEWVERSION =4.1.0.0/>
      < / dependentAssembly>
      < dependentAssembly>
        < assemblyIdentity名称=System.Web.Helpers公钥=31bf3856ad364e35/>
        < bindingRedirect oldVersion =1.0.0.0-2.0.0.0NEWVERSION =2.0.0.0/>
      < / dependentAssembly>
      < dependentAssembly>
        < assemblyIdentity名称=System.Web.Mvc公钥=31bf3856ad364e35/>
        < bindingRedirect oldVersion =1.0.0.0-4.0.0.0NEWVERSION =4.0.0.0/>
      < / dependentAssembly>
      < dependentAssembly>
        < assemblyIdentity名称=System.Web.WebPages公钥=31bf3856ad364e35/>
        < bindingRedirect oldVersion =1.0.0.0-2.0.0.0NEWVERSION =2.0.0.0/>
      < / dependentAssembly>
      < dependentAssembly>
        < assemblyIdentity名称=WebGrease公钥=31bf3856ad364e35/>
        < bindingRedirect oldVersion =1.0.0.0-1.3.0.0NEWVERSION =1.3.0.0/>
      < / dependentAssembly>
    < / assemblyBinding>
  < /运行>
  <&的EntityFramework GT;
    < defaultConnectionFactory TYPE =System.Data.Entity.Infrastructure.LocalDbConnectionFactory,的EntityFramework>
      <&参数GT;
        <参数值=11.0/>此处输入code
      < /参数>
       < / defaultConnectionFactory>
     < /&的EntityFramework GT;
   < /结构>


解决方案

这似乎是路由处理程序未加载中...

您确保应用程序池设置为一体?如果是尝试在你的 web.config中添加此行

 <模块runAllManagedModulesForAllRequests =真正的>< /模块>

请,请确保您有也是这些处理器在应用程序中注册的:

 <添加名称=ExtensionlessUrlHandler-ISAPI-4.0_32bitPATH =*。动词=GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS模块=IsapiModulescriptProcessor ​​=%WINDIR%\\ Microsoft.NET \\框架\\ v4.0.30319 \\ ASPNET_ISAPI.DLLpreCondition = classicMode,runtimeVersionv4.0,bitness32responseBufferLimit =0/>
<添加名称=ExtensionlessUrlHandler-ISAPI-4.0_64bitPATH =*。动词=GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS模块=IsapiModulescriptProcessor ​​=%WINDIR%\\ Microsoft.NET \\ Framework64 \\ v4.0.30319 \\ ASPNET_ISAPI.DLLpreCondition = classicMode,runtimeVersionv4.0,bitness64responseBufferLimit =0/>
<添加名称=ExtensionlessUrlHandler - 集成 - 4.0PATH =*。动词=GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONSTYPE =System.Web.Handlers.TransferRequestHandlerpreCondition =integratedMode,runtimeVersionv4.0/>

I created a simple app and ran it on visual studio. Then I went to "Project properties > web" and changed it to "Use local IIS server".

Now when I debug, I can't see anything, even localhost\MySite\Home will return 404. It look like the iis is looking for a folder called \home under the site main folder, instead of looking for a controller named home.

IIS has my application as site with application pool default ASP.Net , Integrated mode.

What is wrong?

my config is standard from wizard:

<?xml version="1.0" encoding="utf-8"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit     http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework"     type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <connectionStrings>
   <!--<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-MvcApplication2-20130718122501;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-MvcApplication2-20130718122501.mdf" providerName="System.Data.SqlClient" />-->
    <add name="DefaultConnection" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\aspnet-MvcApplication2-20130718122501.mdf;Initial Catalog=aspnet-MvcApplication2-20130718122501;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" />
  </connectionStrings>
  <appSettings>
    <add key="webpages:Version" value="2.0.0.0" />
    <add key="webpages:Enabled" value="false" />
    <add key="PreserveLoginUrl" value="true" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" />
    <authentication mode="Forms">
      <forms loginUrl="~/Account/Login" timeout="2880" />
    </authentication>
    <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.Optimization" />
        <add namespace="System.Web.Routing" />
        <add namespace="System.Web.WebPages" />
      </namespaces>
    </pages>
  </system.web>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
  <handlers>
    <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
    <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
    <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
    <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*."     verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
    <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*."     verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
    <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" /></handlers></system.webServer>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="DotNetOpenAuth.Core" publicKeyToken="2780ccd10d57b246" />
        <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.1.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="DotNetOpenAuth.AspNet"     publicKeyToken="2780ccd10d57b246" />
        <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.1.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35"     />
        <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-1.3.0.0" newVersion="1.3.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="v11.0" />enter code here
      </parameters>
       </defaultConnectionFactory>
     </entityFramework>
   </configuration>

解决方案

It seems like routing handler is not being loaded...

Are you sure the application pool is set to integrated? If yes try to add this line in your web.config:

<modules runAllManagedModulesForAllRequests="true"></modules>

Please, make sure you have also these handlers registered in your application:

<add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />

这篇关于在IIS 7部署ASP.Net MVC应用程序4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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