500内部服务器错误,要求在净MVC 3网站的任何资源文件(CSS,JS,图像) [英] 500 Internal Server Error requesting any resource files (css, js, images) in an .Net MVC 3 site

查看:1348
本文介绍了500内部服务器错误,要求在净MVC 3网站的任何资源文件(CSS,JS,图像)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新:事情我想 - 见下面回答的解决方案


  1. 我安装了一个新的MVC3的网站,它正确地担任了资源。这样就避免了在machine.config设置有问题。

  2. 我再当在web.config节段,看是否在web.config中任何特定的变化而引起的问题。当CONFIGS是相同的,新鲜的网站仍然工作,旧的网站仍然打破。

  3. 我卸载了IIS,重新安装了IIS,然后试图清除被徘徊在任何设置再次安装的应用程序。仍然borked。

  4. 然后我用发布(而不是MSI部署),以新的目录。我用IIS选项在完全相同的code即碎的新目录创建应用程序。事情完美。

  5. 我假定文件的权限,所以我删除违规的目录,并重新命名为新的工作版本的旧目录名。网站仍然borked。这使我认为某些IIS设置,是不是在machine.config或web.config中是难辞其咎的。

  6. 我用IIS 6元数据库资源管理器(是的,我用它在IIS 8点),发现并没有在工作现场不少条目。逐个删除之一后,我发现这是我们的MSI期间被添加安装导致问题的脚本映射条目。这是加入到在安装过程中自动添加通配符映射。它工作在IIS6,但显然不是IIS8。

我们有一个WebForms和MVC3应用程序,它看起来像一个应用程序。这是部署在许多环境中(2003年,2008年,WIN 7)和正常工作。我刚才这些应用了新的Windows Server 2012的计算机上,一切工作除了获得资源文件MVC网站。浏览器获得一个

  500内部服务器错误
服务器应用程序不可你试图在此Web服务器上访问的Web应用程序当前不可用。请点击Web浏览器中的刷新按钮重试您的请求。管理员注意:错误消息详述此特定请求失败的原因可以在Web服务器的应用程序事件日志中找到。请检查此日志项以发现导致发生此错误。

该资源在_layout.cshtml引用

 < HEAD>
    < META HTTP-EQUIV =X-UA兼容内容=IE = EmulateIE8'/>
    <标题> @ this.Title< /标题>
    <脚本类型=文/ JavaScript的SRC =@ Url.Content(〜/脚本/ 2012.2.607 / jQuery的-1.7.1.min.js)>< / SCRIPT>
    <脚本类型=文/ JavaScript的SRC =/ Sentri7 /脚本/ jQuery的-p1s.banner.js>< / SCRIPT>
    <脚本类型=文/ JavaScript的SRC =/ Sentri7 /脚本/ jQuery的-p1s.patientsearch.js>< / SCRIPT>
    <链接类型=文/ CSS相对=样式的href =/ sentri7 /内容/ jQuery的-p1s.patientsearch.css>< /链接>
    <链接类型=文/ CSS相对=样式的href =/ sentri7 /内容/ jQuery的-p1s.banner.css/>
    <链接类型=文/ CSS相对=样式的href =/ quantifi /资源/应用/ CSS / jQueryUI的/ jQuery的-UI-1.7.2.custom.css/>
    <链接类型=文/ CSS相对=样式的href =/ quantifi /资源/应用/ CSS / Styles.css中/>
    @(RenderSection(PageHead,要求:FALSE))
< /头>

以及使用Telerik的ScriptManager的

  @ {
    标题=申报条件;
    SelectedSubTab = SubTabIndex.Reportables;
    。Html.Telerik()ScriptRegistrar()默认组(DG =方式> DG
        。新增(〜/脚本/ ReportableConditions / List.js)
        。新增(〜/脚本/ ClientObjects / GridSettings.js))
        .OnDocumentReady(bootStrapUI());
}

如果我尝试直接导航到JavaScript文件,我得到了同样的错误:

 的http:// [服务器] /S7D/Scripts/2012.2.607/jquery-1.7.1.min.js

有些怪异的东西:


  1. 如果我IISRESET并击中了js文件,它会工作只有第一个请求。


  2. 任何JS,CSS,或从服务器上的另一个(web表单)网站(相同的应用程序池)请求的图像工作正常。


  3. 有什么也没有与此相关的500错误事件日志中。


我曾尝试添加权限完全权限的应用程序池正在运行的用户。我还增加了文件权限设置为[机器] \\ IUSR。

下面是我的web.config

 <?XML版本=1.0编码=UTF-8&GT?;
<结构>
  < configSections>
    < sectionGroup NAME =Telerik的>
      <节名称=webAssetsTYPE =Telerik.Web.Mvc.Configuration.WebAssetConfigurationSection,Telerik.Web.MvcrequirePermission =FALSE/>
    < / sectionGroup>
    < sectionGroup NAME =春天里>
      <节名称=类型别名TYPE =Spring.Context.Support.TypeAlias​​esSectionHandler,Spring.Core/>
      <节名称=背景TYPE =Spring.Context.Support.WebContextHandler,Spring.Web/>
      <节名称=对象TYPE =Spring.Context.Support.DefaultSectionHandler,Spring.Core/>
    < / sectionGroup>
    < sectionGroup NAME =system.web.webPages.razorTYPE =System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup,System.Web.WebPages.Razor,版本= 1.0.0.0,文化=中性公钥= 31BF3856AD364E35 >
      <节名称=主机TYPE =System.Web.WebPages.Razor.Configuration.HostSection,System.Web.WebPages.Razor,版本= 1.0.0.0,文化=中性公钥= 31BF3856AD364E35requirePermission =假 />
      <节名称=页面TYPE =System.Web.WebPages.Razor.Configuration.RazorPagesSection,System.Web.WebPages.Razor,版本= 1.0.0.0,文化=中性公钥= 31BF3856AD364E35requirePermission =假 />
    < / sectionGroup>
  < / configSections>
  <春>
    <上下文中,GT;
      &所述;! - 负载的web.config定义**该资源引用是必不可少来定义web.configs对象 - >
      <资源URI =配置://春/对象/>
      <资源URI =集结号://CAS2/CAS2.CASLibDAO/_SpringObjects.xml/>
      <资源URI =文件://~/App_Data/MvcApplicationContext.xml/>
      <资源URI =集结号://P1S.S7D.Core/P1S.S7D.Core.ApplicationContext/ApplicationContext-Common.xml/>
      <资源URI =集结号://P1S.S7D.Core/P1S.S7D.Core.ApplicationContext/ApplicationContext-DAO.xml/>
      <资源URI =集结号://P1S.S7D.Core/P1S.S7D.Core.ApplicationContext/ApplicationContext.xml/>
      <资源URI =集结号://P1S.S7D.Core/P1S.S7D.Core.ApplicationContext/Services.xml/>
      <资源URI =集结号://P1S.S7D.Common/P1S.S7D.Common.ApplicationContext/ApplicationContext-AuthModule.xml/>
      <资源URI =集结号://P1S.S7D.Common/P1S.S7D.Common.ApplicationContext/ApplicationContext-Web-Common.xml/>
      <资源URI =集结号://P1S.S7D.Core/P1S.S7D.Core.ApplicationContext.WCF/ApplicationContext.xml/>
      <资源uri=\"assembly://P1S.S7D.Core/P1S.S7D.Core.ApplicationContext/ApplicationContext-Circular-Reference-I$p$pporting.xml\" />
    < /背景>
    <对象的xmlns =htt​​p://www.springframework.net>
      <! - 缓存的对象 - >
    < /对象>
  < /春>
  < system.web.webPages.razor>
    <主机factoryType =System.Web.Mvc.MvcWebRazorHostFactory,System.Web.Mvc,版本= 3.0.0.0,文化=中性公钥= 31BF3856AD364E35/>
    <页面pageBaseType =P1S.S7D.Web.Mvc.WebViewPage>
      <&命名空间GT;
        <添加命名空间=P1S.S7D.Web.Mvc/>
        <添加命名空间=System.Web.Helpers/>
        <添加命名空间=System.Web.Mvc/>
        <添加命名空间=System.Web.Mvc.Ajax/>
        <添加命名空间=System.Web.Mvc.Html/>
        <添加命名空间=System.Web.Routing/>
        <添加命名空间=System.Web.WebPages/>
        <添加命名空间=Telerik.Web.Mvc.UI/>
      < /命名空间>
    < /页>
  < /system.web.webPages.razor>  <&的appSettings GT;
    <添加键=Spring.Data.NHibernate.Support.OpenSessionInViewModule.SessionFactoryObjectNameVALUE =NHibernateSessionFactory/>
    <添加键=Spring.Data.NHibernate.Support.OpenSessionInViewModule.EntityInterceptorObjectNameVALUE =MultiTenantInterceptor/>
    <添加键=网页:版本值=1.0.0.0/>
    <添加键=ClientValidationEnabledVALUE =真/>
    <添加键=UnobtrusiveJavaScriptEnabledVALUE =真/>
  < /的appSettings>
  <&的System.Web GT;
    <的sessionState allowCustomSqlDatabase =真模式=SQLServer的sqlConnectionString =服务器= dev-ct-nhsn.dev.rph.int;数据库= ASPState的;用户ID = UID;密码= *****;应用程序名称= S7DSharedSession/>
     <编译调试=真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 =ApplicationServicesenablePasswordRetrieval =假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>
    <页面pageBaseType =P1S.S7D.Web.Mvc.WebViewPage>
      <&命名空间GT;
        <添加命名空间=P1S.S7D.Web.Mvc/>
        <添加命名空间=System.Web.Helpers/>
        <添加命名空间=System.Web.Mvc/>
        <添加命名空间=System.Web.Mvc.Ajax/>
        <添加命名空间=System.Web.Mvc.Html/>
        <添加命名空间=System.Web.Routing/>
        <添加命名空间=System.Web.WebPages/>
        <添加命名空间=Telerik.Web.Mvc.UI/>
      < /命名空间>
      <控制与GT;
        <添加标签preFIX =ASP的命名空间=System.Web.UI.WebControls集结号=System.Web.Extensions程序,版本= 4.0.0.0,文化=中性公钥= 31bf3856ad364e35/>
      < /控制>
    < /页>
    <&HttpHandlers的GT;
      <添加动词=GET,HEAD路径=asset.axd验证=假TYPE =Telerik.Web.Mvc.WebAssetHttpHandler,Telerik.Web.Mvc/>
    与LT; / HttpHandlers的>
    <&的HttpModules GT;
      <添加名称=AuthenticationModuleTYPE =Web.Handlers.AuthenticationModule,P1S.S7D.Web.Mvc/>
      <添加名称=春TYPE =Spring.Context.Support.WebSupportModule,Spring.Web/>
      <添加名称=OpenSessionInViewTYPE =Spring.Data.NHibernate.Support.OpenSessionInViewModule,Spring.Data.NHibernate31/>    < /&的HttpModules GT;
        <的customErrors模式=关/>  < /system.web>
  < system.webServer>
    <验证validateIntegratedModeConfiguration =FALSE/>
    <模块runAllManagedModulesForAllRequests =真正的>
      <添加名称=春TYPE =Spring.Context.Support.WebSupportModule,Spring.Web/>
      <添加名称=AuthenticationModuleTYPE =Web.Handlers.AuthenticationModule,P1S.S7D.Web.Mvc/>
      <添加名称=OpenSessionInViewTYPE =Spring.Data.NHibernate.Support.OpenSessionInViewModule,Spring.Data.NHibernate31/>    < /模块>
    &所述;! - - >
    <&处理GT;
      <清除NAME =资产/>
      <添加名称=资产preCondition =integratedMode动词=GET,HEAD路径=asset.axdTYPE =Telerik.Web.Mvc.WebAssetHttpHandler,Telerik.Web.Mvc/>
    < /处理器>  < /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>
    < assemblyBinding的xmlns =瓮:架构 - 微软COM:asm.v1>
      < dependentAssembly>
        < assemblyIdentity名称=NHibernate的文化=中性公钥=aa95f207798dfdb4/>
        < bindingRedirect oldVersion =3.1.0.4000NEWVERSION =3.3.1.4000/>
      < / dependentAssembly>
    < / assemblyBinding>
  < /运行>
  <&Telerik的GT;
    < webAssets useTelerikContentDeliveryNetwork =FALSE/>
  < / Telerik的>
< /结构>

所有的资源,无论是使用Telerik的或脚本标记添加他们给500错误。该控制器和视图正确显示(无样式或JavaScript)

编辑:

注册路线:

 公共静态无效的RegisterRoutes(RouteCollection路线)
    {
        routes.IgnoreRoute({}资源个.axd / {*} PATHINFO);
        RouteTable.Routes.RouteExistingFiles = FALSE;
        routes.MapRoute(
           默认,//路线名称
           {控制器} / {行动} / {ID},// URL带参数
           新{控制器=家,行动=索引,ID = UrlParameter.Optional} //参数默认
       );
    }


解决方案

正如我的编辑提及。问题是不正确的IIS设置,我发现与IIS 6元数据库资源管理器。

我用IIS 6元数据库资源管理器(是的,我用它在IIS 8点),发现并没有在工作现场不少条目。逐个删除之一后,我发现这是我们的MSI期间被添加安装导致问题的脚本映射条目。这是加入到在安装过程中自动添加通配符映射。它工作在IIS6,但显然不是IIS8。

我不知道为什么会文件得到​​正确担任了第一个请求,但随后的请求,但在取出项工作。我无法找到脚本映射在IIS GUI设置的任何地方,但它可能是那里的地方。

UPDATE: Things I tried - see answer below for solution

  1. I installed a fresh MVC3 site and it served up the resources properly. That eliminated the machine.config settings as a problem.
  2. I then when section by section in the web.config to see if any particular changes in web.config caused the problem. When the configs were identical, the fresh site still worked and the old site was still broken.
  3. I uninstalled IIS, reinstalled IIS, and then installed apps again in an attempt to clear any settings that were lingering around. Still borked.
  4. I then used publish (instead of msi deploy) to new directory. I used the iis option to "Create Application" on new directory of exact same code that is broken. Things worked perfectly.
  5. I assumed file permissions, so I deleted offending directory and renamed new working version to old directory name. Site was still borked. This made me assume that some iis setting that is not in the machine.config or web.config is to blame.
  6. I used IIS 6 Metabase explorer (yes I used it on IIS 8 site) and saw quite a few entries that were not in the working site. After deleting one by one, I found it was the "scriptMaps" entry that was being added during our MSI install causing a problem. This was added to automatically add wildcard mappings during install. It works on IIS6, but apparently not on IIS8.

We have an webforms and MVC3 application that look like one application. This is deployed in many environments (2003, 2008, Win 7) and works properly. I have just set these applications up on a new Windows Server 2012 machine and everything works except getting resource files for the MVC site. The browser gets a

500 Internal Server Error
Server Application Unavailable

The web application you are attempting to access on this web server is currently unavailable.  Please hit the "Refresh" button in your web browser to retry your request.

Administrator Note: An error message detailing the cause of this specific request failure can be found in the application event log of the web server. Please review this log entry to discover what caused this error to occur. 

The resources are referenced in the _layout.cshtml

<head>
    <meta http-equiv='X-UA-Compatible' content='IE=EmulateIE8' />
    <title>@this.Title</title>
    <script type="text/javascript" src="@Url.Content("~/Scripts/2012.2.607/jquery-1.7.1.min.js")"></script>    
    <script type="text/javascript" src="/Sentri7/scripts/jquery-p1s.banner.js"></script>
    <script type="text/javascript" src="/Sentri7/scripts/jquery-p1s.patientsearch.js"></script>
    <link type="text/css" rel="stylesheet" href="/sentri7/content/jquery-p1s.patientsearch.css"></link>
    <link type="text/css" rel="stylesheet" href="/sentri7/content/jquery-p1s.banner.css" />
    <link type="text/css" rel="stylesheet" href="/quantifi/resources/application/css/jqueryui/jquery-ui-1.7.2.custom.css" />
    <link type="text/css" rel="stylesheet" href="/quantifi/resources/application/css/styles.css" />
    @(RenderSection("PageHead", required: false))
</head>

as well as using the telerik scriptmanager:

@{
    Title = "Reportable Conditions";
    SelectedSubTab = SubTabIndex.Reportables;
    Html.Telerik().ScriptRegistrar().DefaultGroup(dg => dg
        .Add("~/Scripts/ReportableConditions/List.js")
        .Add("~/Scripts/ClientObjects/GridSettings.js"))
        .OnDocumentReady("bootStrapUI()");
}

If I try to navigate directly to the javascript file, I get the same error:

http://[server]/S7D/Scripts/2012.2.607/jquery-1.7.1.min.js

Some weird stuff:

  1. If I IISReset and hit the js file, it will work the first request only.

  2. Any js, css, or image requested from another (webforms) site (same app pool) on the server works fine.

  3. There is nothing in the event log related to this 500 error.

I have tried adding permissions full permissions to the user that the app pool is running. I have also added file permissions to the [Machine]\IUSR.

Here is my web.config

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <configSections>
    <sectionGroup name="telerik">
      <section name="webAssets" type="Telerik.Web.Mvc.Configuration.WebAssetConfigurationSection, Telerik.Web.Mvc" requirePermission="false" />
    </sectionGroup>
    <sectionGroup name="spring">
      <section name="typeAliases" type="Spring.Context.Support.TypeAliasesSectionHandler, Spring.Core" />
      <section name="context" type="Spring.Context.Support.WebContextHandler, Spring.Web" />
      <section name="objects" type="Spring.Context.Support.DefaultSectionHandler, Spring.Core" />
    </sectionGroup>
    <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
      <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
    </sectionGroup>
  </configSections>
  <spring>
    <context>
      <!-- Load web.config definition ** This resource reference is essential to define objects in the web.configs -->
      <resource uri="config://spring/objects" />
      <resource uri="assembly://CAS2/CAS2.CASLibDAO/_SpringObjects.xml" />
      <resource uri="file://~/App_Data/MvcApplicationContext.xml" />
      <resource uri="assembly://P1S.S7D.Core/P1S.S7D.Core.ApplicationContext/ApplicationContext-Common.xml" />
      <resource uri="assembly://P1S.S7D.Core/P1S.S7D.Core.ApplicationContext/ApplicationContext-DAO.xml" />
      <resource uri="assembly://P1S.S7D.Core/P1S.S7D.Core.ApplicationContext/ApplicationContext.xml" />
      <resource uri="assembly://P1S.S7D.Core/P1S.S7D.Core.ApplicationContext/Services.xml" />
      <resource uri="assembly://P1S.S7D.Common/P1S.S7D.Common.ApplicationContext/ApplicationContext-AuthModule.xml" />
      <resource uri="assembly://P1S.S7D.Common/P1S.S7D.Common.ApplicationContext/ApplicationContext-Web-Common.xml" />
      <resource uri="assembly://P1S.S7D.Core/P1S.S7D.Core.ApplicationContext.WCF/ApplicationContext.xml" />
      <resource uri="assembly://P1S.S7D.Core/P1S.S7D.Core.ApplicationContext/ApplicationContext-Circular-Reference-IPReporting.xml" />
    </context>
    <objects xmlns="http://www.springframework.net">
      <!--cached objects-->
    </objects>
  </spring>
  <system.web.webPages.razor>
    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <pages pageBaseType="P1S.S7D.Web.Mvc.WebViewPage">
      <namespaces>
        <add namespace="P1S.S7D.Web.Mvc" />
        <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" />
        <add namespace="Telerik.Web.Mvc.UI" />
      </namespaces>
    </pages>
  </system.web.webPages.razor>



  <appSettings>
    <add key="Spring.Data.NHibernate.Support.OpenSessionInViewModule.SessionFactoryObjectName" value="NHibernateSessionFactory" />
    <add key="Spring.Data.NHibernate.Support.OpenSessionInViewModule.EntityInterceptorObjectName" value="MultiTenantInterceptor" />
    <add key="webpages:Version" value="1.0.0.0" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
  </appSettings>
  <system.web>
    <sessionState allowCustomSqlDatabase="true" mode="SQLServer" sqlConnectionString="Server=dev-ct-nhsn.dev.rph.int;Database=aspstate;User ID=UID;Password=*****; Application Name=S7DSharedSession" />
     <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 pageBaseType="P1S.S7D.Web.Mvc.WebViewPage">
      <namespaces>
        <add namespace="P1S.S7D.Web.Mvc" />
        <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" />
        <add namespace="Telerik.Web.Mvc.UI" />
      </namespaces>
      <controls>
        <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
      </controls>
    </pages>
    <httpHandlers>
      <add verb="GET,HEAD" path="asset.axd" validate="false" type="Telerik.Web.Mvc.WebAssetHttpHandler, Telerik.Web.Mvc" />
    </httpHandlers>
    <httpModules>
      <add name="AuthenticationModule" type="Web.Handlers.AuthenticationModule,P1S.S7D.Web.Mvc" />
      <add name="Spring" type="Spring.Context.Support.WebSupportModule, Spring.Web" />
      <add name="OpenSessionInView" type="Spring.Data.NHibernate.Support.OpenSessionInViewModule, Spring.Data.NHibernate31" />

    </httpModules>
        <customErrors mode="Off" />

  </system.web>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules runAllManagedModulesForAllRequests="true">
      <add name="Spring" type="Spring.Context.Support.WebSupportModule, Spring.Web" />
      <add name="AuthenticationModule" type="Web.Handlers.AuthenticationModule,P1S.S7D.Web.Mvc" />
      <add name="OpenSessionInView" type="Spring.Data.NHibernate.Support.OpenSessionInViewModule, Spring.Data.NHibernate31" />

    </modules>
    <!--    -->
    <handlers>
      <remove name="asset" />
      <add name="asset" preCondition="integratedMode" verb="GET,HEAD" path="asset.axd" type="Telerik.Web.Mvc.WebAssetHttpHandler, Telerik.Web.Mvc" />
    </handlers>

  </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>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="NHibernate" culture="neutral" publicKeyToken="aa95f207798dfdb4" />
        <bindingRedirect oldVersion="3.1.0.4000" newVersion="3.3.1.4000" />
      </dependentAssembly>
    </assemblyBinding>    
  </runtime>
  <telerik>
    <webAssets useTelerikContentDeliveryNetwork="false" />
  </telerik>
</configuration>

All the resources, whether using Telerik or adding them with the script tag give the 500 error. The controller and view show up correctly (without styles or javascript)

EDIT:

Register Routes:

    public static void RegisterRoutes(RouteCollection routes)
    {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
        RouteTable.Routes.RouteExistingFiles = false;
        routes.MapRoute(
           "Default", // Route name
           "{controller}/{action}/{id}", // URL with parameters
           new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
       );
    }

解决方案

As mentioned in my edits. The problem was an incorrect IIS setting that I found with the IIS 6 Metabase Explorer.

I used IIS 6 Metabase explorer (yes I used it on IIS 8 site) and saw quite a few entries that were not in the working site. After deleting one by one, I found it was the "scriptMaps" entry that was being added during our MSI install causing a problem. This was added to automatically add wildcard mappings during install. It works on IIS6, but apparently not on IIS8.

I am not sure why the files would get served up properly on the first request, but not subsequent requests, but removing the entry worked. I could not find the "ScriptMaps" setting anywhere in the IIS GUI, but it is probably there somewhere.

这篇关于500内部服务器错误,要求在净MVC 3网站的任何资源文件(CSS,JS,图像)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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