ASP.NET MVC3 routing with areas not working only on deployment server - asp.net-mvc-3-areas

I have an Asp.Net MVC3 web applications, which uses Areas.
When I run it from visual studio using IISEXPRESS everything is working just fine.
But when I deploy the application to my test server, the application won't render any views which are located in areas.
On my development machine the url that is generated looks like this:
http://localhost:58366/myapp/settings/convertemplates
(settings = the name of the area, converttemplates = name of controller)
on the test server, the url is different:
http://testserver/myapp/converttemplates?Area=settings
How is it possible the routing works as expected on my development machine, but fails on the test server ?

I found the problem... (but I do not understand the implications...)
the config contained the following line
<system.web>
<compilation debug="true" targetFramework="4.0" optimizeCompilations="true">
when I remove optimizeCompilations="true" routing again works like expected.

Related

How to create IIS-website from powershell in order to host .net core 2.0 app, error 0x8007000d

Expected Result:
IIS hosts my app correctly, and when I navigate to the url of my app (e.g: blabla/swagger) I see the swagger UI describing my app
Problem:
When I try to navigate to my app it says:
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
Information
I built an app in .net core 2.0 and I am able to make it run through visual studio, being hosted by Kestrel.
However I need to deploy this app to different servers and since Kestrel doesn't support host names, I need to make it being hosted in IIS . When I make it run through Kestrel I am able to access it correctly and by navigating to the url/swagger address, I am able to see the correct swagger page that describes the app.
My app is being published from visual studio. Which means in its published folder there are all the dlls that the app needs. It's being published as a framework dependent app, not a standalone one, but this shouldn't matter.
How to replicate the problem
Since I need this one day to be hosted in IIS inside a Docker container, I am trying to make it being hosted in IIS with powershell scripts. What I did to make it being hosted in IIS is:
New-Website -Name 'myTestApp' -force -Port 8080 -PhysicalPath
'C:\Users\myUser\Desktop\Docker\PublishOutput' -ApplicationPool 'MyAppPoolTest'
Where C:\Users\myUser\Desktop\Docker\PublishOutput is the path to the published folder where Visual Studio publishes the app. Thanks in advance!
This is the web.config generated by Visual studio when publishing:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\Friss.CaseApi.Web.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</configuration>
<!--ProjectGuid: 313d542d-7676-4440-ae1b-22c6071f4309-->
And the error page is:
Am I setting the web.config in the wrong way?
Check the documentation here
You need to publish your website and then point IIS website to the published folder
Application pool must be set to No Managed code
Application Pool identity user IIS AppPool\{AppPoolName} must have read permissions on the published website folder
Found the solution,
the system requires the dotnet core windows hosting bundle. The bundle installs the .NET Core Runtime, .NET Core Library, and the ASP.NET Core Module.
Documentation: https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-2.1&tabs=aspnetcore2x
Direct download to the bundle for .netcore 2.0.6 that solved my problem:https://download.microsoft.com/download/8/D/A/8DA04DA7-565B-4372-BBCE-D44C7809A467/DotNetCore.2.0.6-1-WindowsHosting.exe

Deploy the asp.net MVC 2 web application to the IIS 7.5 getting issues

I have developed the asp.net mvc web application. whereas my macine is configured with IIS 7.5. I want to deploy my web application with source code to the IIS so that i can attache the process and debug it run time. I choose this way because few functionality , like file copy and file create not performing after simple publish.
I tried by ,
Create the web application in IIS 7.5 manager. installed ASP.NET utility. As i browsed , I got asked by to enable directory browsing.
Which i enabled. where as in IE I found file structure which definitely did not want. I expected direct my LogOn page which is configured in globle.asax after deployment.
What else i need to check. or is any step i have missing?
I am using Visul web developer 2010 express edition to develop the application.
Please guide me.

Deploying Hybrid ASP.NET webform and MVC project on iis7 - MVC Routing does not work

Hi Stackoverflow,
Im trying to deploy a hybrid ASP.Net Webform/mvc-project onto iis7 but the mvc routing does not work.
This is what i have done so far:
Added all required mvc-related dlls.(i have double checked bin-catalog to make sure that everythings there on the deployed installation)
Added MVC wildcard by adding the IsapiModule handler to iis handler mappings.
The Server has .Net-Framework 3.5 SP1 installed.
The web site Managed pipeline mode set to classic
Our project requires the app pool to be running in none-integrated pipeline, but im not sure what MVC requires of the app pool, may i run ASP.NET MVC(2) in a none-integrated managed pipeline?
The web application loads and i want to use the MVC-routing to load javascript but the mvc routing does not responde to the request and instead Webforms gives us a 404-response,
this only happens when the project has been deployed onto the server.
Does anyone has a idea of why the ASP.Net MVC routing does not fire?
Thanks and Best regards,
Mikael
I found the error, the installer did not update production web.config,
so there was some missing mvc-required references,
i used this article to find out what was missing, it describes how to setup a hybrid WebForm/Mvc project in a simple way.
And now im able to run a hybrid webform/mvc-project on iis7 classic without any problem.

ASP.NET MVC on IIS falls through to the static file handler

I have a problem with an ASP.NET MVC site.
These are the details:
ASP.NET MVC 2
ASP.NET 4 integrated pipeline
IIS 7.5 on Windows Web Server 2008 R2
Whenever I make a request for the app I get the "HTTP Error 404.0 - Not Found"-error and the detailed error information shows it is the static file handler that reports the error:
Module: IIS Web Core
Notification: MapRequestHandler
Handler: StaticFile
Error Code: 0x80070002
meaning that the request never entered the MVC stack.
I should note that the IIS already serves a ASP.NET MVC 3 on the same app pool and a MVC 2 on a ASP.ENT 2 app pool. So it's the combo ASP.NET 2 on the ASP.NET 4 app pool that are giving me headaches.
Basically I want to upgrade the app from ASP.NET MVC 2 on a ASP.NET 2.0 app pool to a ASP.NET MVC 2 on a ASP.NET 4.0 app pool.
So any ideas?
I see you fixed your issue, but for anyone googling:
I had this issue and in my case I just needed to register ASP.NET 4 with IIS. I was deleting and re-adding webs to fix other issues and simply forgot to do that. The command that worked for me was:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319>aspnet_regiis -i
Your own .net version may be different, especially if you are in the future, so the above path may not be exactly right.
I had the same problem when I installed IIS after installing Visual Studio, etc.
I was able to fix the problem by changing my Web.config file, adding the runAllManagedModulesForAllRequests="true" to the <modules> tag:
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
...
</modules>
</system.webServer>
(More details/copied from here: http://www.west-wind.com/weblog/posts/2011/Mar/27/ASPNET-Routing-not-working-on-IIS-70)
Chris' answer got me to check whether the app pool was actually configured for .net 4. Sure enough, this server defaults to creating 32-bit .net 2 pools in classic mode.
Ensure that your app is using 4.0 and you'll probably want Integrated pipeline for all new development. 32/64 is mainly up to your dependencies. The default is leaving "allow 32 bit allocations" set to false.
In my case, a similar error was thrown because StaticFile Handler was disabled / not working properly. I eventually fixed it by removing the handler and re-adding it through the web.config. Also, in case of a 403.3 error, change the RequireAccess-property value from "Write" to "Read"
<configuration>
<system.webServer>
<handlers>
<remove name="StaticFile"
<add
name="StaticFile"
path="*" verb="*"
modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule"
resourceType="Either"
requireAccess="Read" />
</handlers>
</system.webServer>
</configuration>
So I found the error. There was a left over default document in the root, which isn't necessary for apps using the integrated pipeline. Also some changes to Global.ascx and route registration was neessary, but after that it worked.

Setting up separate ASP.NET app with DotNetNuke

I've got DotNetNuke (v5.1.4 Community Edition) setup on a Windows Server 2008 64-bit system (using SQL Server 2008 64-bit for the backend database), and I want to reference a separate ASP.NET application from it. I plan to display the ASP.NET application via an IFrame module on the DNN site. I'd like the ASP.NET application to recognize the user that is currently logged into the DNN site. I'm trying to do this by creating a web application (in IIS) under the DNN web site on the web server. That is, the ASP.NET web application is a child of the DNN web site (we're using IIS7).
When I do this and then navigate to the ASP.NET site I get this error message:
"Could not load file or assembly
'DotNetNuke.HttpModules' or one of its
dependencies."
Based on this article. I added the < clear / > tag to the httpModules section of the ASP.NET applications web.config.
Now I'm getting this error message:
"Could not load file or assembly
'DotNetNuke' or one of its
dependencies"
Also, the debugging information mentions something about DotNetNuke.UI.WebControls.CaptchaHandler, but I don't think that's the source of the problem. That is, it's just a coincidence that the CaptchaHandler is the first item in the httpHandlers section.
I tried adding the < clear / > tag to the httpHandlers section, but get this error message:
"No http handler was found for request
type 'GET'"
Any ideas on what might be going on and how to fix it?
You can modify the root dnn web.config and add <location inheritInChildApplications="false"> around the <system.webServer> and <system.web> tags.
The end result will be something along these lines...
<location path="." inheritInChildApplications="false">
<system.webServer>
...
</system.webServer>
<system.web>
...
</system.web>
</location>
Well I think you may have missed a step from that post - what you need to do is in the application that is sitting 'below' dnn make sure that you remove the http modules in its web.config. It doesnt sound like you have done that.