1

Ok so deploying to local IIS my project works fine. Deploying to the online host, I only get directory listing.

(

Using VisualStudio 2012, mvc3, .net 4.5 Publish to Web settings:

  1. Publish method: FTP
  2. Server: www."mysite".co.za
  3. Site Path: "blank" (My understanding is that I'm publishing directly to the app directory, so my root contains bin, views, global.asax, web.config)
  4. Destination URL: http://www."mysite".co.za
  5. Databases are already up and configured in web.config

)

If click on the Views directory I get the 404 error.

What I did next was to see if it executes global.asax, so I added code to throw an exception in RegisterRoutes (Called from Application_Start())

    public static void RegisterRoutes(RouteCollection routes)
    {      
      routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

      routes.MapRoute(
        "Default", // Route name
        "{controller}/{action}/{id}", // URL with parameters
        new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults        
      );

      throw new Exception("This is my custom error: Currently in RegisterRoutes");      
    }

And true's Bob, I get the following (but still only if I click on my View directory):

Server Error in '/' Application.

This is my custom error: Currently in RegisterRoutes

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.Exception: This is my custom error: Currently in RegisterRoutes

So my questions: 1. Why would my root not pick up global.asax? 2. How can I see where execution of code ends after routes.MapRoute(...)? (that is, after removing the throw Exception ;) )

Regards

event.er
  • 65
  • 1
  • 8

2 Answers2

1

This has happened to be as well. Usually this is due to some missing settings in the web config. Specifically, this question, provided the answer. Edit the web config to load all managed modules for all requests.

<system.webServer><modules runAllManagedModulesForAllRequests="true"></modules></system.webServer>
Community
  • 1
  • 1
Josh
  • 776
  • 6
  • 20
0

You probably didn't register IIS on your server. Please register it using aspnet_regiis -i and then check the .net version under application pool in IIS.

Jitendra Pancholi
  • 7,897
  • 12
  • 51
  • 84