ASP.net MVC ERROR after deploying on the hosting web site - asp.net-mvc

I get the assembly error
Parser Error Message: Could not load file or assembly 'System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
Any idea what needs to be included.

Did you make sure to copy the second web.config file that resides in the Views directory up to the host?
Also the following should be in the "main" web.config.
<assemblies>
<add assembly="System.Web.Mvc, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
...
</assemblies>
Phil Haack explains how to BIN deploy the MVC here if your host has notr installed.
Kindness,
Dan

You will need to install the MVC redistribution files from here

Does the web hosting server has the MVC framework installed? I am assuming you installed in on the development environment but not on your hosting server. You need to install the framework also on the hosting server.
If the hosting server has the MV framework installed, check that the version installed on the development environment is the same as the hosting environment.

Have you set your project to do bin deployment?
See this post by Phil Haack:
http://haacked.com/archive/2008/11/03/bin-deploy-aspnetmvc.aspx

In Visual Studio in your project go to the reference folder find the "System.Web.Mvc", "System.Web.Routing", and "System.Web.Abstractions" and set the "Copy Local" property to TRUE. This will copy the files to the Bin directory of your application, when your app is built. Your webserver does not have these files installed, that is why you are getting this error.

Related

Umbraco Child MVC Application (Virtual Directory) - Could not load file or assembly Umbraco.ModelsBuilder

I'm trying to deploy a custom, pure ASP.NET MVC app as a Virtual Directory "Application" under my Umbraco 7 site root. However, I always get the following YSOD error:
Server Error in '/DemoApp' Application.
Could not load file or assembly 'Umbraco.ModelsBuilder' or one of its dependencies. The system cannot find the file specified.
I've also tried this from scratch to eliminate as many variables as possible. Here are the repro steps:
Created a brand new empty ASP.NET solution/project
Added the UmbracoCms nuget package (7.4.3)
Built the solution
Setup my IIS Site - "UmbracoDemo" with host name umbraco-demo.local
Browsed to http://umbraco-demo.local and ran the Umbraco installer
NOTE: So far everything works as expected. I can log into the back office or browse the new Umbraco site..
Created a new ASP.NET MVC application in a new VS solution called "DemoApp"
Built the new solution and ran it immediately with IIS Express -- the MVC app works correctly
In IIS Manager, I right-clicked my UmbracoDemo site and added an "Application" called "DemoApp", pointing it to the DemoApp MVC project directory
Added "~/DemoApp" to the umbracoReservedPaths setting in Umbraco's web.config
Browsed to http://umbraco-demo.local/DemoApp
Again I get the error:
Could not load file or assembly 'Umbraco.ModelsBuilder' or one of its dependencies. The system cannot find the file specified.
Additional info:
I don't think this is specifically related to ModelsBuilder. Just to see what would happen, I added this to my "DemoApp" web.config:
<assemblies>
<remove assembly="Umbraco.ModelsBuilder" />
</assemblies>
Now the error message says:
Could not load file or assembly 'UrlRewritingNet.UrlRewriter' or one of its dependencies. The system cannot find the file specified.
So naturally, I tried adding:
<remove assembly="UrlRewritingNet.UrlRewriter" />
But this had no impact, the error remained. And in another instance the error mentioned a different assembly instead of UrlRewritingNet.UrlRewriter.
I got this working by adding ~/api/ to:-
<add key="umbracoReservedPaths" value="~/umbraco,~/install/,~/bundles, ~/api/" />
And then wrapping the following web.config sections of my parent umbraco app with the location tag:-
<location path="." inheritInChildApplications="false">
<system.web>
and
<location path="." inheritInChildApplications="false">
<system.webServer>

Failure when deploying MVC 5 web Application

I kept getting this error after deploying my MVC 5 Web Application :
Could not load file or assembly 'System.Web.Http.WebHost,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or
one of its dependencies. The system cannot find the file specified.
After googling around, I found that the reason is the Bin folder lacks of System.Web.Http.WebHost.dll file, then I go to look in the Bin folder of my project, but I also can't find it, but it appears in the References section :
Now I have no idea how to solve this problem, any help is greatly appreciated!
P/s : the web application is running fine on my machine
Try right clicking the reference -> Properties, and set CopyLocal = true . That should put the dll in your bin folder (and thus be included in the deployment as well). Hope that helps!

MVC4-Deployment "Could not load file or assembly 'DotNetOpenAuth.Core, Version=4.0.0.0"?

I am trying to deploy a simple intranet application on my local machine. I've included the deployable assemblies and have deployed it in asp.netv4 app pool but when I try to browse the application i get the below error.
Could not load file or assembly 'DotNetOpenAuth.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246' or one of its dependencies. The system cannot find the file specified
Could anyone please help ? thanks
The first thing you should do is to go to your MVC web application project and expand the References node in the project tree. Select the DotNetOpenAuth assemblies and in the Properties dialog, set Copy Local to True. and then deploy it.
MVC.NETProject->References->Remove OAuth*

subdomain with mvc godaddy hosting

I've published my mvc app to godaddy (root, ie www.example.com) and all works great. Now I need to post some html files to a subdomain (ie subdomain.example.com) which I've set up.
However now when I browse to subdomain.domain.com I get web.config error
"Could not load file or assembly
'System.Web.Helpers, Version=1.0.0.0,
Culture=neutral,
PublicKeyToken=31bf3856ad364e35' or
one of its dependencies. The system
cannot find the file specified." Line
101: add
assembly="System.Web.Helpers,
Version=1.0.0.0, Culture=neutral,
PublicKeyToken=31BF3856AD364E35" /...
The only files in subdomain directory are html files. Why is web.config coming into play? I thought having a subdomain would separate these virtual directories (root and subdomain)?
You mention these are .html files. Sure they're not .cshtml?
Domain oddities aside - your host doesn't have the "ASP.NET Webpages" System.Web.Helpers assembly in their GAC, or otherwise available for your deployment.
To solve this, you need to bin-deploy the assemblies. Start by creating a bin directory, and uploading the System.Web.Helpers.dll there.
You'll find it on your developer machine at somewhere like C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies\System.Web.Helpers.dll
I used these instructions from the GoDaddy site to get mine working:
To Deploy MVC3 Applications with Windows Hosting
In your application's project, add references to the following assemblies:
Microsoft.Web.Infrastructure
System.Web.Helpers
System.Web.Mvc
System.Web.Razor
System.Web.WebPages
System.Web.WebPages.Deployment
System.Web.WebPages.Razor
For each reference you just added, set the Copy Local property to True.
Deploy your application.

ASP.NET MVC on IIS 6 problems

I am trying to get MVC to work on IIS6 and am having issues.
I went through the steps on Haaked
http://haacked.com/archive/2008/11/26/asp.net-mvc-on-iis-6-walkthrough.aspx
I am trying to get the IIS6 Extension-less URLs to work
I have done the steps,and when I navigate to my site I get this error:
Could not load file or assembly 'System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
any thoughts?
Make sure "CopyLocal" is set to true on your System.Web.Mvc reference in Visual Studio.

Resources