asp.net mvc application not working after publish

2.3k Views Asked by At

i have a wired problem with my app. as along as i run my app using visual studio, there is no problem but when i try to publish and run it using IIS i get the following error

[NullReferenceException: Object reference not set to an instance of an object.]
   Achasoft.AchaCms.Web.RouteConfig.RegisterRoutes(RouteCollection routes) +813
   Achasoft.AchaCms.Web.MvcApplication.Application_Start() +182

[HttpException (0x80004005): Object reference not set to an instance of an object.]
   System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +9859725
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +118
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +336
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296

[HttpException (0x80004005): Object reference not set to an instance of an object.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9873912
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254

i read some articles about Application_Start in IIS 7 but shouldnt the default (asp.net mvc application template) routing work...

3

There are 3 best solutions below

0
On

You should check these:

  • Server features, that supports asp.net site.
  • Too add all deployable dependencies.
  • If you have database, to check connection string
1
On

Check if your Hosting provider supports Specific version of MVC you are using or they even support MVC.

1
On

Please check the publish code that all the dll related to the MVC were published. Because by default MVC dll's was not copy to the local.