简体   繁体   中英

Scripts in mvc blank

I started with an mostly empty project: Empty WebAPI the project has grown a bit, and now I need to have 1 layouted page.

Things added for that page:

Added controller named: StreamController

Added a /Views/Stream/Details.cshtml file.

the web.config and in /Views there is another web.config containing:

<add namespace="System.Web.Optimization" /> And added it's reference.

added /Scripts folder and added my scripts

Added a BundleConfig and RouteConfig (just copied them from an Asp.net WebApi project that was generated from the standard project creation.

Added my bundles to the BundleConfig

Added the config's in Global.asax .

Problem:

When I go to a /Scripts/xxx.js it return blank.

Am I forgetting a config ? or something?

There was something wrong in my web.config. I updated my system.webServer tot the following and it works now.

<system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules runAllManagedModulesForAllRequests="true">
        <remove name="WebDAVModule" />
    </modules>
    <handlers>
        <remove name="WebDAV" />
        <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="classicMode,runtimeVersionv4.0" />
    </handlers>
</system.webServer>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM