1

Server Error in '/' Application.

'respond' is not a valid script name. The name must end in '.js'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: 'respond' is not a valid script name. The name must end in '.js'.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[InvalidOperationException: 'respond' is not a valid script name. The name must end in '.js'.] System.Web.UI.ScriptReference.GetDebugName(String releaseName) +140 System.Web.UI.ScriptReference.ShouldUseDebugScript(String releaseName, Assembly assembly, Boolean isDebuggingEnabled, Assembly currentAjaxAssembly) +48 System.Web.UI.ScriptReference.DetermineResourceNameAndAssembly(ScriptManager scriptManager, Boolean isDebuggingEnabled, String& resourceName, Assembly& assembly) +106 System.Web.UI.ScriptReference.GetUrlFromName(ScriptManager scriptManager, IControl scriptManagerControl, Boolean zip, Boolean useCdnPath) +77 System.Web.UI.ScriptReference.GetUrlInternal(ScriptManager scriptManager, Boolean zip, Boolean useCdnPath) +370 System.Web.UI.ScriptReference.GetUrlInternal(ScriptManager scriptManager, Boolean zip) +61 System.Web.UI.ScriptReference.GetUrl(ScriptManager scriptManager, Boolean zip) +123 System.Web.UI.ScriptManager.RegisterUniqueScripts(List`1 uniqueScripts) +167 System.Web.UI.ScriptManager.RegisterScripts() +405 System.Web.UI.ScriptManager.OnPagePreRenderComplete(Object sender, EventArgs e) +145 System.Web.UI.Page.OnPreRenderComplete(EventArgs e) +9753946 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5054

I don't know where to even begin looking for the cause of this error Happens when i debug my ASP.NET web app in VS2015.

It seems to have happened if I deleted Global.asax class because before that it would work locally but not when deployed to web when it threw type ambiguous errors. I have now since re-added the Global.asax class, but to no avail.

Mike Debela
  • 1,930
  • 3
  • 18
  • 32
shredder
  • 85
  • 1
  • 10

3 Answers3

2

After adding

    RouteConfig.RegisterRoutes(RouteTable.Routes);
    BundleConfig.RegisterBundles(BundleTable.Bundles);

to global.asax, it's working again.

Dale K
  • 25,246
  • 15
  • 42
  • 71
shredder
  • 85
  • 1
  • 10
1

See: scriptreference named respond no longer works

Check if you have a dependency on Respond.js (https://github.com/scottjehl/Respond), probably in site.master:

 <asp:ScriptManager runat="server">
        <Scripts>
         ...
            <asp:ScriptReference Name="respond" />
         ...
        </Scripts>
    </asp:ScriptManager>

If so make sure you include the files, you can add them using Nuget by searching for Respond, once you've done that you'll see Respond.js under the /scripts folder.

You may also need to Add a definition in Bundleconfig.cs inside RegisterBundles to point Respond to the scripts:

           ScriptManager.ScriptResourceMapping.AddDefinition(
             "respond",
             new ScriptResourceDefinition
             {
                 Path = "~/Scripts/respond.min.js",
                 DebugPath = "~/Scripts/respond.js",
             });

Rebuild and run.

Anthony
  • 1,776
  • 17
  • 29
0

The problem for me was simple, my files were located in a folder managed by a cloud service (i.e. Google File Stream). I moved my files out and problem was gone.

Dale K
  • 25,246
  • 15
  • 42
  • 71
Jean-Philippe
  • 13
  • 1
  • 4