Run mvc application on local IIS get 500 error - asp.net-mvc

I want to run my mvc application on local IIS and use this article for do that, but when I run my project in borwser I have got error 500.19
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
All of answers in this question didn't resolve my problem. I'm using visual studio 2015 update 3 and IIS 10.
What's the problem?

Installing IIS Features on Windows 8 and Windows 10
The following procedure describes how to install IIS and the required features for the Microsoft Dynamics NAV Web client on Windows 8 and Windows 10.
To install IIS features on Windows 8 and Windows 10
On the Start page, choose Control Panel, and then choose Programs.
Under Programs and Features, choose Turn Windows features on or off.
The Windows features dialog box appears.
Expand the root-level item .NET Framework 4.5 Advanced Services (for Windows 8) or .NET Framework 4.6 Advanced Services (for Windows 10), and then do the following:
Select ASP.NET 4.5 (for Windows 8) or ASP.NET 4.6 (for Windows 10).
Expand WCF Services, and then select HTTP Activation.
Expand the root-level item Microsoft .NET Framework 3.5 (including .NET 2.0 and 3.0), and then select Windows Communication Foundation HTTP Activation.
Note
The Microsoft .NET Framework 3.5 (including .NET 2.0 and 3.0) item is only available if.NET Framework 3.50 is installed. If the item is not shown, then there is no action for this step.
Expand the root-level item Internet Information Services, expand World Wide Web Services, and then do the following:
Expand Application Development Features, and select the following features:
.NET Extensibility 3.5 (if .NET Framework 3.5 is installed)
.NET Extensibility 4.5 (for Windows 8) or .NET Extensibility 4.6 (for Windows 10)
ASP.NET 3.5 (if .NET Framework 3.5 is installed)
ASP.NET 4.5 (for Windows 8) or ASP.NET 4.6 (for Windows 10)
ISAPI Extensions
ISAPI Filters
Expand Common HTTP Features, and then select the Static Content feature.
Expand Security, and then select the following features:
Request Filtering
Windows Authentication
Under Internet Information Services, expand Web Management Tools, and then select IIS Management Console.
This is an optional step to install Internet Information Service IIS Manager. You use Internet Information Service IIS Manager to manage local and remote web servers and sites.
Choose the OK button to complete the installation.
To verify that the web server has been installed correctly, start your browser, and then type http://localhost in the address.
The default web site opens and should display an IIS 8 image.
Reference

Asp.net 4 not install use this https://msdn.microsoft.com/en-us/library/k6h9cz8h.aspx

Related

Adding an MVC project to an existing web application with .Net 4

I have an existing old WebForms application.
I need to add an MVC project.
The server where it is hosted is Windows 2003 R2, so only .Net 4 can be used.
And we use VS 2017.
I tried to add the project, but there is only "Empty" option available, and the "MVC" checkbox below is disabled, as well as "Web Forms" and "Web API".
Could you please tell how I can add an MVC project?
Presumably you need to download the ASP.NET MVC 4 installer.
The bigger question is, why not spin up an additional webserver which can support newer versions of .net?

MVC 4 website with .NET 4.5 on IIS 8 in Windows 8 gives 403.14 forbidden error [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I have a website that I built in Visual Studio 2012 using MVC 4 and .NET framework 4.5. When I try to run it via IIS 8 on a machine running Windows 8 Pro, I get a 403.14 Error. It says
"Forbidden
The Web server is configured to not list the contents of this directory.
Most likely causes:
A default document is not configured for the requested URL, and directory browsing is not enabled on the server."
Here are some things I have tried that did not work:
Run %windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i and
%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -ir in both this and the Framework64 directory. This gives this error: "This option is not supported on this version of the operating system. Administrators should instead install/uninstall ASP.NET 4.5 with IIS8 using the "Turn Windows Features On/Off" dialog, the Server Manager management tool, or the dism.exe command line tool. For more details please see http://go.microsoft.com/fwlink/?LinkID=216771." The link goes to a page about Windows Server 2012 which does not help. I could not find a specific setting in "Turn Windows Features on or off" dialog for iis 8. Everything relating to .net 4.5 is turned on.
Add to in Web.config. This gives the error: "This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false"."
I have made sure .net 4.5 is installed on the server (the installer said it is built into windows 8 and does not need to be installed). The application pool is the default pool using .net 4.0, integrated pipeline, with 32 bit applications enabled. I'm publishing to the default directory (inetpub\wwwroot) and the default site that was there worked fine. HTTP Redirection is turned on in "Turn windows features on or off"
Can anyone offer any more insights?
EDIT:
Well, of course right after I post this I found something that works. Go figure.
In "Turn Windows Features on or off", under Internet Information Services -> World Wide Web Services -> Application Development Features, make sure that .NET Extensibility 3.5, .NET Extesibility 4.5, ASP.NET 3.5, ASP.NET 4.5, ISAPI Extensions, and ISAPI Filters are SELECTED.
This was outlined here: http://www.iis.net/learn/get-started/whats-new-in-iis-8/iis-80-using-aspnet-35-and-aspnet-45#TOC301258515 but since that refered to server 2012 instead of windows 8 I couldn't find the right location for these settings.
Hope this helps anyone with a similar problem. Thanks for reading.
In "Turn Windows Features on or off", under Internet Information Services -> World Wide Web Services -> Application Development Features, make sure that .NET Extensibility 3.5, .NET Extesibility 4.5, ASP.NET 3.5, ASP.NET 4.5, ISAPI Extensions, and ISAPI Filters are SELECTED.
This was outlined here: http://www.iis.net/learn/get-started/whats-new-in-iis-8/iis-80-using-aspnet-35-and-aspnet-45#TOC301258515 but since that refered to server 2012 instead of windows 8 I couldn't find the right location for these settings.
Note: Answer added to clean the question from unanswered

my webapi mvc4 not run in server with net.4.0

hello I made one applicattion(WEB API MVC4 which connect with SQL server) using framework 4.5, in my IIS express run fine but I try publish in other server which uses framework 4.0, my applicattion not run ?
I change in properties of my application works with framework 4.0 and in my IIS express run fine but other server not run.
I can't upload version framework in the other server.
thanks for the asnwers and sorry for my english I'm learning
Maybe you have changed target framework attribute in your web application that isn't sufficient to deploy. In your codes you may use libraries that require .net 4.5 while you only have changed the setting. About running this in your iis express must say that your system by default supports .net 4.5 while your app says i need only .net 4.0. So .net 4.5 related parts will be compiled and executed on local server and no ambiguous thing is here.
Running .NET4.5 based app on .NET4 machine is not supported. Simply because .NET4.5 is a super set of .NET4. Everything that's built for .NET4 works on .NET4.5 but not the other way around. If you are using Visual Studio 2012, you can change TargetFramework (in project properties) to .NET Framework 4, this will ensure that your app is built for .NET4.
--Varun
(.NET Framework Team)

Host a ASP.Net MVC3 application on my own 2008 server with IIS 7.0

This seems to be so easy that it is documented nowhere.... I have finished my first MVC3 project and now I want to host it on my own IIS7 (W2008) server. How is it done?
There are two options. If you have control of the server and can install on it, the easiest is to install the ASP.NET MVC 3 Framework on it and then install and configure the MVC app as any other web application.
If the runtime cannot be installed on the server, option called Bin Deployment can be used.
This is what I did to install get MVC running on Windows 7 Professional or greater. For Windows Server 2008, please see this link. The IIS management component should be the same for Windows 7 / Server 2008. The install process will be a little different.
Start > Control Panel > Programs and Features > Turn Windows features on of off
Expand Internet Information Services and check off all that you need (FTP, World Wide Web)
Specifically I use FTP (FTP Service), and WWW Services with Application Development (.NET Extensibility, ASP, ASP.NET, ISAPI Extensions, and ISAPI Filters) enabled. Under security you should at least enable Basic Authentication.
After this is done, go to here to get the Web Platform Installer, which will allow you to easily install .NET 3.5/4.0, MVC, and other features you might need such as MS SQL Express.
Once this is done, go to Start > Control Panel > Administrative Tools > Internet Information Services Managger
Expand COMPUTERNAME, expand sites, right click Default Web Site (unless you want to use a different folder, if so, right click sites and click "Add New"), whichever site you choose, you can right click and choose "Add FTP Publishing". From there just follow the prompts, and allow access to whichever users you want. Now you can FTP in from Microsoft visual Studio 2010 (Using Publish).
In Visual Studio - right click the MVC application you want to publish, go to Publish, enter the ftp site settings (most likely ftp://localhost if its a local install), user, password, and whether or not to replace or delete files. You can save this profile so you don't have to re-enter this information every time.
This question/answer might even be more geared toward serverfault, or superuser, not sure? If so I'm sure it will be moved.

Is there a certain IIS configuration required to allow a functioning .Net 4.0 ASP.Net MVC 2 Azure application?

I just installed the Azure 1.2 tools update and would like to get to work on an Azure project running locally using ASP.Net MVC and .Net 4, but I cannot get MVC pages to load.
If I just create a new Azure project in VS 2010, add a ASP.Net MVC web role, and run the application, pages never load. It appears that routing is somehow at fault as controller actions never get called, but if I add other pages to the project (like .htm or .aspx) they will load in the browser.
It all works fine with a new project using .Net 3.5, MVC 2 project in the Azure development environment; it all works fine with .Net 4.0 MVC 2 project that is not running in Azure; only the combination does not work.
Environment is Win 7 x64 (IIS 7.5), VS 2010, Azure tools 1.2
Is there some magic IIS setting I need to change or something? Any ideas?
Check if you have "HTTP Redirection" feature enabled.
See here

Resources