MVC 4 WebApi 404 when published to production - asp.net-mvc-4

I've been working on a new MVC 4 application and in the development environment everything has been working correctly, yet after deploying to our production environment I've found that my WebApi's no longer resolve and as a result I'm only getting 404's when I try to use my api's
I've checked my web.config and I can't find anything that's as miss and I've made sure that I've got the following in my web.config
<modules runAllManagedModulesForAllRequests="true"></modules>
however this is not helping either.
I've also in an attempt to make sure that the server would run the MVC 4 project I've even installed the MVC4 framework which has not helped either.

Related

HTTP 500 error launcing ASP.NET 3.0 application

I have just upgraded our ASP.NET Core 2.2 web application to 3.0. It builds and deploys fine. The problem is when I go to run it from our IIS server. This was running perfectly fine as a Core 2.2 web app, but now fails since upgrading to Core 3.0.
When I launch the web app from the commandline there are no reported errors.
When I launch the application from the browser the Windows logs indicate that the app started correctly.
The app then fails with an HTTP 500 error. Here are the IIS log entries.
We're using Windows Server 2012 R2 with IIS 8.5.9600.16384
The app appears to start correctly but then fails with an HTTP 500 error. Has anyone else seen this or something similar? Any ideas how to diagnose / fix the problem?
UPDATE
I've attached the VS 2019 debugger to the deployed app via the w3wp.exe process and it's not even hitting any of the middleware (I have a breakpoint at Startup() in Startup.cs).
I've tried changing the application pool settings e.g. identity, .NET version but to no avail.
When I launch the site from the web server I get the following error message which doesn't really tell me anything.
I can't see what's causing the problem.
.NET Core 3.0 uses the in-process hosting model by default. You may need to upgrade the .NET Core Hosting Bundle.
You will check web.config "aspNetCore"
<aspNetCore processPath="dotnet" arguments=".\Api.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
maybe proccessPath is wrong.
if it doesn't solve problem , write to log step step startup.cs.
Maybe throw error in startup.cs
After investigation and comparison of the build artifacts that the build produces vs the deployed app, I discovered that the appsettings.json was not being deployed. No idea how or when this started failing, but it caused the app to generate an HTTP 500 error message. Our app's Azure ADB2C settings are contained in this file so it was crashing trying to authenticate but couldn't find the authentication settings.
There was no obvious error being generated and everything seemed to be loading fine. It was at the point at which the app was trying to authenticate that it was failing. All working now.

Changing host name on development machine for ASP.net Core 2.1 MVC doesn't work (fine on MVC 5)

I want to change the local host name so http://localhost/app1 could, say, become http://app1 - for a few different ASP.net Core 2.1 MVC websites.
I'm using IIS in Windows 10. (I have all sorts of reliability issues with IIS Express every time I try it - I'd rather use full IIS).
I've followed this article:
https://www.mojoportal.com/adding-a-host-name-to-the-hosts-file-for-local-testing
changing the hosts file then adding new websites in IIS rather than adding applications under the default website.
I want to do this for various reasons including preventing passwords from autofilling across many websites on localhost.
This works fine on MVC 5 sites - but in .net Core 2.1 MVC sites I get a
HTTP Error 502.5 - Process Failure
If I look in the log - and I've tried this on various sites - I get an error such as this:
An assembly specified in the application dependencies manifest
(AppName.deps.json) was not found:
package: 'Stripe.net', version: '19.8.0'
path: 'lib/netstandard1.2/Stripe.net.dll'
This doesn't only happen for Stripe.
The deps.json file I guess is being dynamically created - I can't find it. The sites deploy to the server fine.
Why does this happen - and how can I change hostname away from localhost for .net core 2.1 MVC sites?
If I create a template .net Core 2.1 MVC site it lets me do it fine, strangely but can see no obvious differences.
I can't find anything on Google directly about this though I've looked for a few hours.
I found this - but it didn't help:
ASP .NET Core 2.0 Change "localhost" to a "hostname"
Thanks.
Update
A vanilla .net core mvc 2.1 application works fine but as soon as 1 nuget package is installed this error happens again:
An assembly specified in the application dependencies manifest
(hosttest.deps.json) was not found
So there's some path issue to nuget packages - can't find how to fix it though.

Deploying MVC 4 with Razor on IIS 7

I've created an MVC 4 project and am trying to deploy it on IIS 7. I've seen a lot of suggestions and tried some and had no luck. I'm very new to IIS so I need this explained as thoroughly as possible if someone can. I currently run my MVC application from localhost and then I add something like this to the end of the URL.
/data/filldata?name=...
So my first question is, how do I deploy the MVC website to IIS. My next question is, after deploying it, how do I run it? If I open a web browser, what should I put in the URL. My assumption is the new URL with the directory it's set up in and then that /data/filldata?name=... at the end. Keep in mind that I am a beginner in this so I'm slowly starting to learn how to use IIS. Thanks in advance!

ASP.NET MVC 4 app gives 404, IController error on IIS 7.5/8

The last couple of days I've been trying to deploy MVC 4 applications to IIS 7.5 and 8 installations on Server 2008 R2 and 2012, but I'm basically getting the same error every time: 404 and "The controller for path '/' was not found or does not implement IController." On both servers I've made sure that .NET 4, 4.5 and the full MVC 4 stack are installed. The applications run fine on IIS Express in VS 2012.
Things I've tried and results:
Tried to deploy a clean MVC 3 applicaion: works;
Tried to deploy a clean MVC 4 application: doesn't work;
Tried to deploy a clean ASP.NET 4 WebForms application: works (which, I think, rules out the ASP.NET hosting capabilities being a problem);
Tried to deploy the MVC 4 apps with .NET 4 instead of 4.5: doesn't work (which, I think, rules out the .NET installations being the problem);
Tried to install hotfix 980368: installer says 'This update is not applicable to your computer', so that is probably already installed;
Made sure the app pool is on .NET 4.0;
Made sure all file permissions are setup properly;
Changed verbs on ExtensionlessUrlHandler-Integrated-4.0 to *;
Added the <modules runAllManagedModulesForAllRequests="true" /> tag.
But still no dice... I've read many SO questions and other websites which resemble the errors I'm getting, and I think I've tried all the tips I've read, but maybe I missed a crucial one.
Has anyone else experienced these problems, that can give me the fix I need?
Right, as it seems, adding the debug symbols (.pdb) to the bin folder makes the app start working again, even though it was deployed in Release mode. I'll do some research as to why this happens.
Edit: the answer can be found here: Removing .pdb from ASP.NET app on IIS breaks application

403 Error (Forbidden) when trying to view my MVC4 application on AppHarbor

I'm new to both ASP.net and AppHarbor. I also have never deployed an ASP.net application before.
I've set up an MVC4 website using the Visual Studio 2012 release candidate and it is near completion. Locally, it is working fine / as expected.
To send the client a current progress demo, I've been advised that I should use AppHarbor to host the application / website.
I've gone through the process of setting up a Git repository and connecting that with AppHarbor. I then used the Build -> Publish Selection option in Visual Studio to create a 'Web Deploy Package' within my local copy of the repository. Finally, I pushed the files (shown below) that were created to the repository and AppHarbor listed the commit as 'Active'.
However, when I click Go to your application, all I get is this magnificent 403 page.
I've tried a bunch of things (none of which have worked so far) that I've seen in forums (including here and AppHarbor support), including:
Adding a <modules runAllManagedModulesForAllRequests="true"/>
Ensuring I didn't have multiple web projects.
Checking and confirming that there are no errors listed in AppHarbor.
I've turned CustomErrors off, yielding no differences.
I haven't touched any of the .config stuff since I began the project (because I don't know how to use them yet). Perhaps I've just not added something blatantly obvious in there?
You shouldn't use the Web Publish stuff when you want to deploy to AppHarbor. AppHarbor takes your source code straight up, builds it, tests it and deploys it.
Here's a guide on deploying your first app on AppHarbor using Git. There's also a video on the AppHarbor front page that you can check out.