Javascript file in custom module is not loaded

Topics: Troubleshooting, Writing modules
Aug 6, 2014 at 12:12 PM
Edited Aug 6, 2014 at 3:30 PM
Hi,
i need help with IIS 8.5 config i think, because i'm not able to use a something.js file in my custom module. We have custom module generated by CodeGen, there is Scripts folder with its own web.config:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <appSettings>
    <add key="webpages:Enabled" value="false" />
  </appSettings>
  <system.web>
    <httpHandlers>
      <!-- iis6 - for any request in this location, return via managed static file handler -->
      <add path="*" verb="*" type="System.Web.StaticFileHandler" />
    </httpHandlers>
  </system.web>
  <system.webServer>
    <staticContent>
      <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="7.00:00:00" />
    </staticContent>

    <handlers accessPolicy="Script,Read">
      <!--
      iis7 - for any request to a file exists on disk, return it via native http module.
      accessPolicy 'Script' is to allow for a managed 404 page.
      -->
      <add name="StaticFile" path="*" verb="*" modules="StaticFileModule" preCondition="integratedMode" resourceType="File" requireAccess="Read" />
    </handlers>
  </system.webServer>
</configuration>
I created new javascript file "vav.js" with some functions inside, than i create file ResourceManifest.cs in root of module as recommended with registration of my js file:
using Orchard.UI.Resources;

namespace VaV
{
    public class ResourceManifest : IResourceManifestProvider
    {
        public void BuildManifests(ResourceManifestBuilder builder)
        {
            var manifest = builder.Add();
            manifest.DefineScript("VaVjs").SetUrl("vav.js", "vav.js").SetDependencies("jQuery");
        }
    }
}
I add shortcut to this file in some view using:
Script.Require("VaVjs").AtHead();
It works fine to this point, when i open developer tool in my browser, i see in HEAD tag this:
<script src="/Orchard.Web/Modules/VaV/scripts/vav.js" type="text/javascript"></script>
But when i click on link in src attribute, i see empty body in opened vav.js tab... And there is error in developer tools saying: "Failed to load resource: the server responded with a status of 500 (Internal Server Error)".
I trying a lot of solutions from Internet, but unsuccessfully...
Than i tried cut/paste this file from VaV module to our custom theme Themes/VaVTheme/Scripts and i added it to theme's Layout.cshtml by command:
Script.Include("vav.js").AtHead()
That works, but i would like to have this file in our module...
Settings in web.config files in Scripts directories in module and theme are exactly the same.

And this is result from IIS:
Remote Address:::1:80
Request URL:http://localhost/Orchard.Web/Modules/VaV/scripts/vav.js
Request Method:GET
Status Code:500 Internal Server Error
Request Headersview parsed
GET /Orchard.Web/Modules/VaV/scripts/vav.js HTTP/1.1
Host: localhost
Connection: keep-alive
Cache-Control: no-cache
Accept: */*
Pragma: no-cache
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36
Referer: http://localhost/Orchard.Web/VaV/Aktivity
Accept-Encoding: gzip,deflate,sdch
Accept-Language: sk-SK,sk;q=0.8,cs;q=0.6,en-US;q=0.4,en;q=0.2
Cookie: Orchrd-orchard-web-=%7B%22Exp-N42-New%22%3A%22open%22%7D; cookieVaV=VybranaOsobaID=2; __RequestVerificationToken_L09yY2hhcmQuV2Vi0=sUQOhohgmqmRSAip2kjFEiZs5D9vkOJXC7B6rakJhvy_LYWQ6TPVjWnns2JGBwXlWAKSolsPhgRWZ5vwHLCAM_9gHB_6xb7UVTM_HAIUj6A1; .ASPXAUTH=51B0FE19AE40FCAB12B3DE9935B1F5E533972DA104723252E2091DA79AC792A8C98B9D69E13B4D21FA677505209014CA204A627D36F798F6D5D0CBF6281853049CAC2AEECE1219BC8295129DA9E86FB854A697EEB96E8FEDE58A7AF47E715AC2927897BE8B9DE5EC4906001A110DAC5C
Response Headersview parsed
HTTP/1.1 500 Internal Server Error
Server: Microsoft-IIS/8.5
X-Powered-By: ASP.NET
Date: Wed, 06 Aug 2014 14:23:29 GMT
Content-Length: 0
Aug 7, 2014 at 12:25 PM
SOLVED:
We are using DevExpress components and there was problem in our cusom modul's web.config, where we use recommended DevExpress's handlers. There shouldn't be any DevExpress settings. All needed and recommended settings (assemblies, handlers, razors etc.) should be in main (Orchard.Web) web.config only.
Marked as answer by loshuliveros on 8/7/2014 at 4:25 AM