Azure Full IIS deployment issue - TypeLoadException - asp.net-mvc-3

I have an application using the Azure 1.4 SDK (previously 1.3 with same problem). If I try and deploy the application as Full IIS I get the following error in Intellitrace logs.
System.TypeLoadException: Unable to load the role entry point due to the following exceptions: System.IO.FileLoadException: Could not load the file or assembly 'System.Web.Mvc, Version=2.0.0.0..blah..The located assemblies manifest does not match the assembly reference.
The web site is using ASP.NET MVC 3, not version 2. It seems the Full IIS is looking for the wrong versions of the dll's. I have set the MVC dll's in the project to Copy Local so they should be deployed in the bin directory.
If I deploy the site as a legacy hosted web core by commenting out the sections in the ServiceDefinition.csdef it all deploys and works fine.

This seems like it was an application that may have been created as an MVC2 application, and then later you migrated it to MVC3, correct? The reason it is failing is that you have both MVC2 and MVC3 installed on your machine, and when you're running it locally, your application is loading MVC2 out of the GAC. When you deploy it to Azure it can't find MVC 2, since MVC is not installed on the base Azure images that you get when you create a new Deployment.
I would check through my config files and look very closely for any references to MVC 2.0. Take a look at a reference like this and make sure you haven't overlooked any steps. You may have neglected to change the project type guid, or missed one of the config files.

Related

How to Fix: An assembly specified in the application dependencies manifest was not found:package: 'System.Data.SqlClient'

We are new to .Net Core and are trying to deploy our first application that uses it. We are deploying to a Windows server which has .NET Core Windows Server Hosting Module (2.2.0), the .NET Core Runtime (2.2.0) and I even installed the SDK (2.2.103) to see if that could solve the problem, which it did not.
Error:
An assembly specified in the application dependencies manifest (accesslog.deps.json) was not found:
package: 'System.Data.SqlClient', version: '4.5.1'
path: 'runtimes/win/lib/netcoreapp2.1/System.Data.SqlClient.dll'
So, here is my issue...the above error is being generated when we try to run a .NET Core application via the "dotnet filename.dll" method. We "publish" the application to generate all needed dependencies, or so I thought. The publish (and thus application) folder contain "A" version of this file (System.Data.SQlClient.dll), but apparently not the right one (version in publish path shows 4.6.26606.5), but yet that is the one being generated by Visual Studio.
Oddly, we also have an ASP.NET application on this same server which runs fine and references the same file.
Any help, guidance, troubleshooting steps, etc would be GREATLY appreciated.

.NET Core 2.0 MVC - Precompiled Views not deploying properly in VSTS

I have a .NET Core 2.0 MVC web application that I am trying to get deployed properly through VSTS CI/CD Build and Release definitions. I understand that, by default, .NET Core 2.0 sets Razor View Precompilation to true, in order to precompile all of the Views into a DLL when publishing the application. When I build and publish locally through Visual Studio 2017, everything works fine. When I try to build and release to a web server through VSTS, though, the precompiled DLL for views is not being updated / copied to server.
Is there any solution or fix for this yet? I am seeing a lot of discussion about it online with some workarounds, but many of the posts I am seeing are about a year old or more. So I am wondering if anyone has figured this out yet?
The rest of my MVC deployment seems to be working fine. It is just the precompiled DLL for the Views is not being included in the release and therefore not being copied/overwritten on the server.
Refer to these steps below:
Create a new build definition
Choose ASP.NET Core build template
Modify tasks if needed
Then the necessary files are in the artifact folder (xxx\a).

Deploying .Net Core WebAPI project on IIS

I have created a simple web API using .Net Core and trying to publish it to IIS. But getting HTTP 500.
I followed https://docs.asp.net/en/latest/publishing/iis.html article and did exactly whatever mentioned in that.
I Installed only https://www.microsoft.com/net/download as
DotNetCore.1.0.1-WindowsHosting.exe OPT_INSTALL_REDIST=0
NOTE : I am able to deploy and access MVC application successfully but cannot access WebAPI application with the same steps.
In the IIS logs i am seeing below error.
Failed to start process with commandline '"dotnet" .\Project-1.dll', ErrorCode = '0x80070002'.
I am using the default web api template provided in Visual Studio 2015
am i missing something. Is WebAPI deployment is different to MVC app deployment w.r.t .net core ?
When you install the .NET Core Windows Server Hosting bundle, it won't restart all of the IIS processes if IIS is currently running. This is a good thing, since on a production server you wouldn't want them just to restart, but it would be nice if it was made a little clearer. First, check your System (not User) PATH variable to ensure that the path to Dotnet is there. Then, go into services and restart the Windows Process Activation Service. This will restart all of the IIS bits and get it to update the path. Once you've done this, IIS should serve up your .NET Core app just fine.

Method not found - System.Web.Razor.RazorTemplateEngine.GenerateCode when deploying to azure

I am developing an MVC3 app for azure which is working fine in my local environment, and the azure emulator. However, when I deploy it to azure I get the error 'Method not found: 'System.Web.Razor.GeneratorResults System.Web.Razor.RazorTemplateEngine.GenerateCode'.
I have added the deployable dependencies using Visual Studio
I haven't had much success finding answers on line, any help would be appreciated.
This sounds like a deployment issue. Somehow, the correct .DLL's are not making it over to Azure. Make sure that deployable dependencies are the correct ones.
Try to "bin deploy" it. See if it works. There's great blog here for this.
By default there's no MVC3 related assemblies on azure. If you are using Azure SDK 1.6, you can create a MVC3 web role, it will added all necessary assemblies into your BIN and copied to the azure when deployment.
If you are using SDK earlier than 1.6, you have to manually added them into your references and make sure they are all set to Copy Local = True. The assemblies would be
System.Web.Helpers
System.Web.Mvc
System.Web.Providers
System.Web.Razor
System.Web.WebPages
System.Web.WebPages.Deployment
System.Web.WebPages.Razor

Problem with deploying ASP.NET MVC3 app

This question is related to this: Problem with bin Deploying ASP.NET MVC 3 I erase the line with targetFramework="4.0" but now I have another problem. It says:
Could not load file or assembly 'EntityFramework' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
I can´t get access to IIS server because it is from provider of my hosting. It´s weird because one of my website is running on this server (MVC3 too) and now I am trying add next and it is not working. Thanks for every help.
Have you made sure your provider has .NET 4.0 installed on their server?
It sounds like you are trying to run a .NET 4.0 application on a server that only has .NET 3.5 installed

Resources