ASP.NET web app not deploying correctly on Windows server 2012 - asp.net

So here's the thing. I recently updated a web project to use nuget for its dependencies, which in turn updated all of those dependencies to the latest versions.
Quite a task as there were some breaking changes, but I have the thing running locally perfectly.
We use TeamCity to pull the solution from bitbucket and deploy it the the local iis folder on a development (staging) server.
After a build, the website seems very poorly, first off it complains:
Could not load file or assembly
'file:///C:\web\Dev.Pegfect.Presentation\bin\mscorlib.dll' or one of
its dependencies. An attempt was made to load a program with an
incorrect format.
Which is strange since my local copy does not have a copy of mscorlib in its web bin folder. Should be using the GAC? If I remove the dll, I get a new error (some NHibernate issue complaining about reflection). I haven't pursued that since it all seems environmental.
If I copy my local bin folder over the server web bin, it starts to run ok albeit extremely slowly (relative to how it used to).
So, the question "what have you tried" - i am currently installing VS 2012 onto the server and will try building the project from source directly. I am also considering updating TeamCity from v7 to v9.
I could also try to reinstall IIS8.0 on the server.
These are desperate, blind shots in the dark. What would you try?
FWIW the project is targeting .NET 4.5.1 (ANY CPU)

OK, so I will leave it here as it might help someone.
So, the project has been building, deploying and running successfully on the server compiled to .NET 4.5.1 with no problem.
The recent packages update moved us from MVC v4 to MVC v5. (amongst other things). Running .NET fix tool suggested 4.5.1 was corrupted, so I downloaded the developer version and installed and now its fine.

Related

ASP.Net Core 2 - IIS 502.5 Error

I am creating an ASP .Net Core (2.0) MVC application within Visual Studio 2017 which was working absolutely fine.
After turning off my computer yesterday and coming back to my application today, I now receive this browser error when I start the application in chrome without debugging.
Running dotnet run within the directory of the application, I can access the site just fine. It is just when I run it via Visual Studio/IIS Express I get this error.
HTTP Error 502.5 - Process Failure
The application builds and compiles just fine. I have also cleaned the solution.
Looking in the event logs I find:
Application 'MACHINE/WEBROOT/APPHOST/MYAPP' with
physical root 'C:\Users\Ben Hawkins\Desktop\Development Folder
\Dev\Website\Version_2\MYAPP\MYAPP\'
failed to start process with commandline 'C:\Program Files
(x86)\Microsoft Visual
Studio\2017\Community\Common7\IDE\Extensions\Microsoft\Web
Tools\ProjectSystem\VSIISExeLauncher.exe -argFile "C:\Users\Ben
Hawkins\AppData\Local\Temp\tmp3547.tmp"', ErrorCode = '0x80004005 :
0.
Within my output window in Visual Studio 2017 I recieve this message under
ASP NET CORE WebServer
Failed to initialize CoreCLR, HRESULT: 0x80131534
What I have tried:
Cleaning the solution, rebuilding etc
Restarting the computer
Trying to launch another application. (Same result)
Created a new application from scratch. Same result.
Repairing Visual Studio Community 2017. Same result.
Stopping/Closing IIS Express
My setup was working perfectly yesterday and suddenly is not.
Thank you for your time. I hope we can find a solution.
We finally found the issue! After logging on to the machine as a different user, we saw a warning that the main user had ignored initially. There was a 0 byte file in the root of the directory named "Program" with no file extension. It appears that this causes some sort of issue when VSIISExeLauncher.exe is invoked through Visual Studio. (Note it would work if executed from the command prompt). After deleting the file, everything worked!
We do not know how this file was placed there for certain, but suspect it was some sort of copy error when the user was pulling in files from his old hard drive.
I don't know if anyone else will come across this, but if so hopefully this helps!
Maybe you need install previous versions of .NET Core, isn't it? I installed here and it works now. I had only .NET Core 2.0 installed and I realized that applications with 1.1 stopped so when running. In Windows' event logs I've had the same error registered.
Try to change the IISExpress to IIS by creating new IIS profile and change the Lunch to IIS. It resolved my problem.
I have hit a very similar issue with ASP.net Core 2.0. I had copied my VS project to a new one, and I was getting this error message.
After doing some research, I was able to determine that the nlog.config file was not copied into the bin > Debug > net461 folder. Once I did this, I was able to run my application.
I found it by running dotnet run from the command line on my project where the csproj files live.
Had same issue yesterday (windows 10).
Solved it this way:
Update Microsoft.AspNetCore to latest (Nuget manager - 2.1.3)
Make sure the sdk also updated to latest version. if not, update it manually from Nuget console like this:
Install-Package Microsoft.NETCore.App -Version 2.1.3
Download and install latest ASP.NET Core/.NET Core: Runtime & Hosting Bundle
from here
Same problem with version 2.2. Reinstalling .NET Core SDK fixed the problem for us.
In my case, my project was setup as a website in IIS and the file "bin\IISSupport\VSIISExeLauncher.exe" was missing in the project's directory.
I simply selected "IIS" when debugging the project in Visual Studio 2019 and it generated the missing file. It also generated 2 text files (IISExeLauncherArgs.txt, pidfile.txt) in the IISSupport folder, made changes to my web.config file, and my project ran successfully.
After that I was able to access the local website that was setup in IIS without running it in Visual Studio.

msbuild with no Visual Studio (Yes Windows SDK installed & Copy Local=true)

A project gets built fine from Visual Studio without a problem from developers work station. Now we need to more it to DEV and UAT server. I've been struggling all day trying to get my ASP.NET project built with msbuild on a server with no Visual Studio installed (dev tools not permitted on servers) -
The type or namespace name 'Optimization' does not exist in the namespace 'System.Web'
The type or namespace name 'DotNetOpenAuth' could not be found
Couple attempts were made:
1. Install Windows SDK (http://msdn.microsoft.com/en-US/windows/hardware/hh852363) - appears there has been a lot of discussions from another Stackoverflow post (Related but not exactly - Build ASP.NET 4.5 without Visual Studio on Build Server). You'd also need to add to environment variables PATH
C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\
C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools
(This did NOT help)
2: gacutil to install the dll's?
(no vs command prompt - as said, no dev tool/Visual Studio permitted on server)
3: copy the dlls' to (i.e. same folder as MSBuild.exe):
C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\
(This did NOT help)
4: Copy local = true
(This did NOT help - the dll's apparent msbuild can't find already in bin folder of the ASP.NET application)
It appears to be a bug with msbuild - http://social.msdn.microsoft.com/Forums/vstudio/en-US/434abf1a-30db-4b13-8062-13755898dd71/msbuild-is-unable-to-link-to-a-webapplication-project?forum=msbuild
Anyone has experience with this?
Thank you for your feedback. This is an intentional change made in VS 2012. Projects excluded from a build configuration do not get built when you are building that configuration.
Yes, I've had experience with that. I discovered that excluding the project was handy in the IDE, I think I remember so that stable libraries don't get rebuilt so often; but the user could right-click on that project and build directly just once or when really needed.
But, it broke the MSBuild.exe command-line build, because those projects were not available at all.
One thing is to add conditional logic to the build file so it knows to set things differently for an interactive user or a pure build environment:
Condition="'$(BuildingInsideVisualStudio)' == 'true'"
I ended up eventually improving the build solution in my case, so I can't recall a specific example of the Excluded thing.

Deploy from Visual Studio 2010 stopped working after upgrade to Web Deployment Tool 2.1

I have a web site project that has been existing for a while - it has been ASP.NET MVC2 based up until right now. .Net 4, Visual Studio 2010 Sp1, deployed to IIS 7.5 running on Win2008 R2.
I have four separate deployment profiles - "alpha", "test", "staging" and "live". Yes, I could probably have come up with better names, but they should hopefully convey what they are for.
It was recently decided to upgrade to MVC3 to take advantage of new awesomeness like Razor, global filter attributes, and start using NuGet etc. So I went on an upgrade binge with the Web Platform Installer. One of the things I updated was the Web Deployment Tool - both my developer machine (where the MVC3 upgrade happens) and the web server got this new version of the tool installed.
Since then, I have not been able to do deployments. I have gone back to earlier versions of my project (thanks to git for allowing me to painlessly go back to any previous version) and tried to deploy them, and they don't work either.
Whenever I try to do a deployment from Visual Studio I get the following error:
Web deployment task failed.((23.05.2011 11:18:24) An error occurred when the request was processed on the remote computer.)
(23.05.2011 11:18:24) An error occurred when the request was processed on the remote computer.
Unable to cast object of type 'Microsoft.Web.Deployment.DeploymentSyncOptions' to type 'Microsoft.Web.Deployment.DeploymentSyncOptions'.
I can see why that cast would be hard. ;)
But seriously - how can we get deployment from Visual Studio to work again? In the future we will do this using our CI server, and install a deployment package using MsBuild automatically on the correct web server depending on the git branch that was updated, but that is some time in the future.
I have full access to both machines so any other information need can hopefully be gathered.
You might be having beta version of web deploy on your box if you have ever installed web platform installer v2 beta. YOu can check that by
gacutil -l Microsoft.web.deployment.
If you see any 7.5.0.0 version then you have a beta version. Uninstall this version. You need to check and change this on both the client as well as the server.
Owais is right - this is very likely because you have a pre-release version installed. Rune can you please check and let me know?

problem with SQLite for .NET 4.0

I have downloaded latest version of SQLite. It works great with .Net 4.0. But it is consisted from 3 assemblies not on assembly. It has an extra SQLite.Interop.dll that can not be referenced in Visual Studio 2010. How can I solve this?
Personally I reverted to 1.0.66 because of this issue.
In my development environment, I was able to make it work not by adding SQLite.Interop.dll as a reference of my project, but rather by having it copied next to System.Data.Sqlite.dll in my bin directory. When I tried to deploy my application by doing the same thing on some Win XP machine, it failed miserably. That's why I reverted the to the over a year old 1.0.66.
I'm hoping the this will be fixed soon and that whatever is in SQLite.Interop.dll will be unified in System.Data.Sqlite.dll.
The issue is documented in http://system.data.sqlite.org/index.html/tktview?name=54e52d4c6f
EDIT (2011-07-03):
Seems like the ticket is fixed and you can now download the all-in-one dll again.

Difference in DLL when compiling on Build Server instead of Dev Machine

I have an application that loads user controls into .NET web application. When I compile and test the application locally on my dev machine it works on my machine. The project builds successfully using MSBuild on our build server. However when I deploy the dll generated by MSBuild on the build server I get the following error when the application loads the control:
BC30456: 'CreateResourceBasedLiteralControl' is not a member of 'ASP.usercontrols_somecontrol_ascx'.
I took a look and compared the dll generated on my machine and compared it(looked at the file size) with the one created by the build server and noticed
a difference in the file size. This is confusing considering the code being built locally and on the build server is IDENTICAL. I manually compared each file by hand. So my question is: What is causing this error? What would be different between MSBuild's compilation of the code and what is going on in Visual Studio when compiling the code?
You've got a versioning issue. Some assemblies are different on your target machine than on your dev machine. I'm afraid you're going to have to do some digging to hunt it down, since this error message is entirely unhelpful. Really it's pointing you in the wrong direction since the problem isn't in your assembly. It's probably caused by something in your project References. Have you got some 3rd party tool or SDK on your dev machine that hasn't been updated on the server yet?
The last time I saw this was when I had built a DotNetNuke module that was built against a newer DotNetNuke.dll assembly than my server had.
If you compile that as dll.
Try delete App_Code.dll in bin folder.

Resources