Failure when deploying MVC 5 web Application - asp.net-mvc

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!

Related

MvcRazorToPdf installation issues

I am trying to check out MvcRazorToPdf. I'm installing it from Nuget Manager.
When I attempt to build the project I get this error message:
Error 5 Assembly 'MvcRazorToPdf, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null' uses 'itextsharp, Version=5.5.3.0,
Culture=neutral, PublicKeyToken=8354ae6d2174ddca' which has a higher
version than referenced assembly 'itextsharp, Version=5.5.0.0,
Culture=neutral,
PublicKeyToken=8354ae6d2174ddca' d:\PROJECTS\Crowdiet\packages\MvcRazorToPdf.1.0.2\lib\40\MvcRazorToPdf.dll Crowdiet
In order to solve it I installed the latest version of iTextSharp from Nuget. Version 5.5.7
Now I'm building and so it runs.
However, when trying to execute MvcRazorToPdf code I get the following error message:
Could not load file or assembly 'itextsharp.xmlworker,
Version=5.5.3.0, Culture=neutral, PublicKeyToken=8354ae6d2174ddca' or
one of its dependencies. The located assembly's manifest definition
does not match the assembly reference. (Exception from HRESULT:
0x80131040)
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.IO.FileLoadException: Could not load file or
assembly 'itextsharp.xmlworker, Version=5.5.3.0, Culture=neutral,
PublicKeyToken=8354ae6d2174ddca' or one of its dependencies. The
located assembly's manifest definition does not match the assembly
reference. (Exception from HRESULT: 0x80131040)
Any ideas how to deal with this? Thanks.
DSB I've written this as theres too much to place in a comment.
This link should help address your azure query SO.
In regards to what I had said about updating your wkhtml files you need to click this link wkhtml download (this is a link for the site wkhtml page) as this will provide you with the 3 updated files you need for rotativa. There's 2 things that you can do when the download has finished in order to get these new files into your solution. This download will save a setup program to your computer which contains the 3 files. When you are saving the files make a note of where you are saving them to.
Download 7 zip found at 7zip or any file extracting tool if you don't already have one. Right click on your download and use the extraction tool to extract and save the 3 updated files.
If you can't download or don't have an extraction tool then run the setup of the downloaded file. This should save into your program files in your standard drive. Navigate through program files to the wkhtmltopdf folder, click on it, then click the bin folder and inside this you'll find the 3 updated wkhtml files.
When you've got these three files add these to your existing rotativa folder inside your solution. Do a rebuild of the soultion if necessary just to update it. Hope this 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*

Getting System.IO.FileNotFoundException exception when try to run an application written in F#

Please keep in mind that I am new to world of .Net and F#. I apologize in advance if my question sounds stupid or I don’t use the correct terminology. Having said that, here is my question:
I wrote a simple F# consol application using visual studio 2010. After successfully executes the application on my computer, I moved the executable file found under debug directory to different computer and try to execute it. This results in the following execption
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'FSharp.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
at .$Program.main#()
The tagger machine has .net 4 installed. I checked the GAC and found the following “FSharp.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”
But application is looking for FSharp.Core, Version=4.0.0.0. If I understood correctly, there is no such version of F# 4.0 is available, so why my application is looking for Version=4.0.0.0? Any help is welcome
Thanks
Sudaly
Does the other machine have the F# Runtime installed on it?

How can I install asp.net mvc 2 on IIS7?

I have developed an ASP.NET MVC 2 website, and now need to deploy it to my web server. I've overcome some hurdles already, since ASP.NET was not installed etc. but I've now got to the point where I can serve up plain content files, and if I try to hit one of my MVC URLs I get this:
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.
Not surprising, that, as I've not installed MVC2. Problem is, I can't find any good information about how to install it!
The Microsoft Download Center lists 3 files, none of which look promising:
ASP.NET-MVC-2-RTM-Release-Notes.doc
AspNetMVC2_VS2008.exe
mvc2-ms-pl.zip
The site doesn't bother to explain what the files actually are, but I assume that the last file is the source code. That's what it looks like, anyway. The release notes are no help whatsoever, since they're all about installing on your development machine, and indeed the name of the EXE makes it clear that that's all about Visual Studio integration too.
So how do I actually deploy the darn thing?
The other option linked to from Scott Gu's blog is the Microsoft Web Platform Installer. Now, I don't want to install more than just MVC2, and I already have IIS etc. set up, so this seems a bit heavy. But it's all academic, as it refuses to run on my server, saying "your system is not supported" or words to that effect. (The server is Windows Server 2008 Standard SP2, so I really don't know what it's problem is).
Help!
[It's ridiculous that this should be so hard - or perhaps not hard at all, but certainly a well-kept secret!]
To deploy an MVC application, you just need to ensure that you set the references up to copy to your bin folder. Specifically, these DLLs will need to be in there...
System.ComponentModel.DataAnnotations.dll
System.Web.Abstractions.dll
System.Web.Mvc.dll
System.Web.Routing.dll
Note: Copying a reference to your bin folder.
In practice, you do this by following these steps:
Right-click on the reference in
the "references" section of your
project
Select "Properties"
Locate the "Copy Local" property and
set it to "true"
PLEASE NOTE!
System.Web.Abstractions.dll
System.Web.Routing.dll
You only need these two if .NET 3.5 SP1 has not been installed - if you don't have SP1, you will need to include these two dlls, which are part of SP1 and are needed by MVC for routing.
The correct answer is given by Darin Dimitrov in this answer (posted here for your convenience):
You could do a server install which doesn't require Visual Studio installed:
msiexec /i AspNetMVC2.msi /l*v .\mvc.log MVC_SERVER_INSTALL="YES"
Now you are probably asking where's this AspNetMVC2.msi coming from. Actually you download AspNetMVC2_VS2008.exe from here, rename the .exe to .zip and inside you'll find what you are looking for (in the mvcruntime sub-folder).
Copy System.Web.Mvc.dll from your development machine to the application's Bin folder on the web server (or to the GAC).
This file comes from AspNetMVC2_VS2008.exe.
You do not need to put these files in the Server GAC. You can, but you don't need to.
You can simply copy these files to your /bin directory on the server. In fact, if you have Copy Local set to true when you right click on the reference, it will do just that.
You need to make sure the reference path to this file:
System.Web.Mvc.dll
is in your /bin directory.
I find running the web platform installer tool works great for getting servers and development machines running. It can be found here... http://www.microsoft.com/web/default.aspx

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

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.

Resources