Why is IIS exiting with code 0 whenever I preview in Chrome from Visual Studio? [duplicate] - asp.net

I start a VS2013 VB.Net MVC5 Web Application, set a breakpoint in HomeController About method and run "Start Debugging", navigate to About page and receive the message "Code not running - The current Thread is not currently running or the call stack could not be obtained" preventing any debugging.
If I set a breakpoint in Global.asax Application_Start, the breakpoint works fine. Changing the "Enable Edit & Continue" makes no difference.
Anyone have any ideas what is happening?
Update: My environment was Windows 8.0 Pro with VS2013 Ultimate.
I have since flushed my system and done a completely fresh install of Windows 8.1 Pro, VS2010 Ultimate, VS2012 Ultimate, & VS2013 Ultimate.
Same test done on all 3 versions of VS - File > New Project > MVC (Default). All 3 versions of VS are reporting "Process with an Id of xxx is not running."
VS2013 debug trace reports "The program '[7720] iisexpress.exe: Program Trace' has exited with code 0 (0x0). The program '[xxxx] iisexpress.exe' has exited with code -1073741816 (0xc0000008) 'An invalid handle was specified'."
I have run VS in and out of Administrator mode and receive the same results. I have uninstalled and reinstalled IIS Express 8.0.

For me the solution was a much simpler one. In my Solution Explorer in Visual Studio, I right click on the web project, chose properties and then navigated to the "web" tab. From there I changed the Project URL to another port number. For example, if it was http://localhost:1052 - I changed it to http://localhost:4356.
Not sure if this helps anyone else, but it worked for me - hopefully it will work for you too!

If you are using 64 bit machine
Go to Visual Studio > Tools Menu > Options

I had the same problem and my solution was the following:
Instead of deleting the main applicationhost.config (in your "Documents/IIS Express" folder), check your solution folder for a hidden ".vs" folder with a "config" sub-folder. If that folder exists and it has it's own applicationhost.config file you need to either rename (or delete) that file or edit it and make sure the website(s) configured inside match the ASP.NET web app(s) in your solution that you are trying to debug. Hope this helps.

I had a similar problem while moving from Visual Studio 2013 to Visual Studio 2015 on a MVC project.
Deleting the whole .vs solution worked as a charm as Johan J v Rensburg pointed out.

The following steps fix the problem for VS 2015 and VS 2017:
Close VS.
Navigate to the folder of the solution and delete the hidden .vs folder.
open VS.
Hit F5 and IIS Express should load as normal, allowing you to debug.

The solution to the above problem was a simple one. Close down dev environments, go to Documents folder and rename IISExpress. Now set environment variable _CSRUN_DISABLE_WORKAROUNDS ( ref: http://gauravmantri.com/2013/02/05/workaround-for-iis-express-crashing-when-running-windows-azure-cloud-service-web-role-with-multiple-instances-in-windows-azure-sdk-1-8-compute-emulator/ ).
Now reboot PC, start VS, load website and run in debug. IIS automatically regenerated the IISExpress folder and the environment variable resolved conflicts.

Well.. for me it was Telerik JustMock Q3 2013 (13.3.1015.0) that caused the problem. Uninstalled it from VS 2013 and the problem has gone..
see also ASP.NET-MVC4 Code Not Running
and http://feedback.telerik.com/Project/105/Feedback/Details/63749-unable-to-debug-asp-net-projects-with-q3-2013
One lost day and many new white hairs... Curse on you Telerik guys! ;)

Another scenario may be that the port that IIS is using for your application is already being used by another running application. Try changing the port and see if it works for you.

I started to get this problem with Asp.Net Core Web Applications in Visual Studio 2017. It didn't matter if it was the .Net Core Standard version with .Net 4.5.2 or the Core version with 1.1 in my case. IISExpress crashed when I started debug.
Tried everything, nothing worked until I went into add/remove programs in Windows 10 and I uninstalled .net core 1.0 runtime (I had both 1.0 installed AND 1.1). Once that was uninstalled, I started Visual Studio 2017 and my .Net Core Web applications (both kinds) and they both started working again!

I made it work by doing the following:
Delete the ".vs" folder under the application folder
Delete the "IISExpress" folder from the Document
Enable the 64 bit version of IIS Express on visual studio by going to Tools -> Options -> Projects and Solutions -> Web Projects
May need to delete everything from temp folder
May need to change the port by right click on project, go to properties, under web and change the project url port.

The similar problem occurs in aspdotnet core with the same error The program '[xxxx] iisexpress.exe' has exited with code -1073741816 (0xc0000008).
Log file setup in web.config did not produce any info also:
<aspNetCore stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" />
To find exact error the next step with log info in command prompt helped:
> dotnet restore
> dotnet run
In my case the problem was in dotnet core v 1.0.0 installed, while version 1.0.1 was required to be globally installed.

Go to project directory .vs/config/ and remove applicationhost.config . Then restart project.

I have solved this issue for me. Try to change all Deny values to Allow in file %SYSTEM_DRIVE%\Program Files\IIS Express\AppServer\applicationhost.xml. Please, take into account what IIS Express Web Server you are using in Visual Studio Settings, 32 bit or 64 bit, that means I have to check the file in different folders. Then restart Visual Studio. I don't know about security issues for those config lines, so change them at your own risk, but it has solved my problem.
<section name="asp" overrideModeDefault="Allow" />
<section name="caching" overrideModeDefault="Allow" />
<section name="cgi" overrideModeDefault="Allow" />
<section name="defaultDocument" overrideModeDefault="Allow" />
<section name="directoryBrowse" overrideModeDefault="Allow" />
<section name="fastCgi" allowDefinition="AppHostOnly" overrideModeDefault="Allow" />
<section name="globalModules" allowDefinition="AppHostOnly" overrideModeDefault="Allow" />
<section name="handlers" overrideModeDefault="Allow" />
<section name="httpCompression" overrideModeDefault="Allow" />
<section name="httpErrors" overrideModeDefault="Allow" />
<section name="httpLogging" overrideModeDefault="Allow" />
<section name="httpProtocol" overrideModeDefault="Allow" />
etc.

Delete File C:\Users\congt\Documents\IISExpress

None of the above answers worked for me but I finally found what my issue was. Hopefully this will help someone down the line.
First run IIS Express from command prompt to validate that the site can or cannot be run
https://learn.microsoft.com/en-us/iis/extensions/using-iis-express/running-iis-express-from-the-command-line
Im my case, i got an error saying that C:\Windows\Microsoft.NET\Framework64\v4.0.30319\CONFIG\web.config had malformed xml on line 14. Looking at that line in the file it just said null null null null null etc.
The fix for me was to replace the web.config file with one from my coworkers. IMPORTANT you must get the file from someone running the same version ie if you are VS2015 get a copy from someone running VS2015. If you get it from someone running a different version you will see an error saying it could not load an assembly from the manifest.
Hopefully this helps someone that has tried all the suggestions above. I think the cause of this for me was updating from trial mode and adding a product key within VS2017

In my case the issue was that Virtual directory was not created.
Right click on web project file and go to properties
Navigate to Web
Scroll down to Project Url
Click Create Virtual Directory button to create virtual directory

Resolution fix: For me, the problem was related to active chrome sessions. I closed all of my chrome browser sessions and then tried building to chrome again. I am using Visual Studio Professional 2017 version 15.3.2. The VS application I was running into build errors with was a WebAPI project. When trying to click the green play button, I was getting dialog error stating "Unable to start the program 'http://localhost:18980/'. An operation is not legal in the current state. Hopefully this post helps someone.

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.

Unable to start debugging | Visual studio 2015

I've recently reinstalled win 10 on my pc (so the system is clean now) and when i try to start my asp project even the default one with or without debugging the following error appears -
Unable to start debugging. Operation not supported. Unknown error:
0x80070057
Screenshot.
I tried to reinstall visual studio 2015 community update 3, IIS (Program and feature option) and IIS Express. Nothing helps.
Hmm. A solution to this problem was very odd. In visual studio i created a new asp core template project and ran it. As usual i got an error message but this time something like iis cant connect to the local machine due to naming conflict. In system properties my computer description field was exactly like the computer name. So i cleared it. The problem gone.
In my case, it was visual studio community 2017.
The web project was set to launch the web app with the internal browser.
Once I started the project in any other standard browsers (Chrome, Internet Explorer, Firefox, etc.) I could run the app and debug.
Hope this can be of help to someone!
I almost tore my hair out trying to figure what was wrong - cleaned project, rebooted, cleaned out user folder, deleted virtual directory in IIS - nothing worked.
Turned out in my case it was some misspelled nodes in the web.config file.
Specifically I had:
<system.webServer>
..
<httpprotocol>
<customheaders>
instead of:
<system.webServer>
..
<httpProtocol>
<customHeaders>
Fixed that and problem solved.
Also, had to remove the following (content-type) otherwise the error returned. Not sure if it was a valid setting anyway...
<httpProtocol>
<customHeaders>
..
<add name="Content-Type" value="application/json"/>

An error occurs while loading my ASP.NET application after it is configured for IIS

I changed my ASP.NET web application to use Local IIS, instead of IIS Express. Now after re-opening the solution, the following error occurs while loading the application:
error : Project 'Atlas2' could not be opened because the Visual C# 2015 compiler could not be created. 'Atlas2' is already part of the workspace.
error : Project 'Atlas2' could not be opened because the Visual C#
2015 compiler could not be created. An item with the same key has
already been added.
Would someone please help me how I can reload the project?
I'm using Visual Studio Team Services (was TFS Online), if it helps.
I solved my problem. I unloaded the project and edited .csproj file. I did the following changes:
<UseIISExpress>false</UseIISExpress> to true
Remove <UseIIS>True</UseIIS>
Remove <IISUrl>http://localhost/MyWebApp</IISUrl>
Then I reloaded the project. It worked. Actually it rolled back to use IIS Express.
The same problem occurred at my system and got solved by running The Visual Studio in administrator mode. The issue was IIS having the same host+port name as ASP.NET project and without administrator rights Visual Studio was not able add the website.
I had this error after switching from IIS Express to full IIS with Visual Studio 2015.
I was able to load the project when I ran Visual Studio as Administrator.
I was getting a similar error in VS 2015.
"could not be opened because the visual c# 2015 compiler could not be
created." "with the same key has already been added"
I was able to workaround the issue by opening the solution in Visual Studio 2013, Cleaning the solution, closing visual studio, then opening the same solution in Visual Studio 2015.
I also noticed that after doing this sequence of events, the csproj file of the project that was initially giving this error updated its ProjectExtensions element and set <UseIIS>False</UseIIS>
Image below of diff between csproj when error was occuring and after workaround.
Keep in mind that before I used this workaround, I tried to update that element manually and set to false, but that did not work.
The problem is the app has been configured to use local IIS instead of Express and their coud be two issues for which you are unable to load the app.
Issue 1. You don't have IIS installed in your local system, In this case you have to install IIS or have to open the .csproj file and do the changes:
<UseIISExpress>false</UseIISExpress> to true
Remove <UseIIS>True</UseIIS>
Remove <IISUrl>http://localhost</IISUrl>
Issue 2. Visual studio doesn't have access to IIS, in this case just open the Visual studio in administrator mode.
I was facing similar issue but none of the mentioned solutions worked for me.
However, I was opening my solution from within visual studio recent solutions list. But when I opened the solution file from explorer by double clicking on it, the project loaded correctly.
This often happens when authentication has not been setup in IIS or the website (or virtual directory) has not been setup in IIS. To fix this problem, open IIS manager.
Make sure a website or virtual directory exists for the project and points to the folder that contains the bin folder for your project.
Open Authentication and enable Anonymous Authentication.
Click Edit while Anonymous Authentication is selected.
Select Specific user, enter your Windows credentials (domain\username).
Open .NET Authorization Rules.
Make sure only Allow/All Users exists.
Go to Application Pools->Advanced Settings.
Select Identity and enter your Windows credentials (domain\username).
This should open up the website so Visual Studio can load your project. If not, go to Advanced Settings for you site and select Physical Path Credentials. Make sure that's set to pass-through authentication.
I was getting this error.
I am using IIS-Express. And I have VS2015.
After messing around with the .csproj file....I was able to get it to work.
After comparing my current file to what was in TFS source control, the only difference was this line.
Previously, this line did not exist. In my "working" (after messin' with it) file, I had
<UseGlobalApplicationHostFile />
Again, in the csproj that causes the error, I didn't have the magic line, but in the working csproj, I had it.
Below is the above line, in context. Only use the below for breadcrumbs, do not copy/paste all of it. The magic line is 3 from the bottom.
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>
</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}</ProjectGuid>
<ProjectTypeGuids>{E3E379DF-F4C6-4180-9B81-6769533ABE47};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MyRootNamespace</RootNamespace>
<AssemblyName>MyAssemblyName</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<MvcBuildViews>false</MvcBuildViews>
<UseIISExpress>true</UseIISExpress>
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication>enabled</IISExpressAnonymousAuthentication>
<IISExpressWindowsAuthentication>enabled</IISExpressWindowsAuthentication>
<IISExpressUseClassicPipelineMode>false</IISExpressUseClassicPipelineMode>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
<UseGlobalApplicationHostFile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
I had the same problem when I moved my WCF REST service from IISExpress to localhost. So, what I did was I opened the .csproj file in Notepad and looked for UseIISExpress, changed its value from false to True.
Then opened VS2015 as administrator and it worked. The good thing is that when I run the project it is still running on my localhost not IISExpress.
I had this issue with an upgrade for Visual Studio 2017. It has been fixed and is now available in an updated release.
You can download the latest update via the in-product notification or from https://www.visualstudio.com
Ref:
Project could not be opened because the Visual C# 2017 compiler could not be created
I created a new Sln file.
Close the Solution.
Open the Project file of the main project. Add the offending projects back to the new Sln file.
Save the Sln file over the top of the old faulty one.
I had the same exact error, this is what solved my issue. In the root of your solution you should see a .vs/config/applicationhost.config. In this folder delete the offending site. Mine looked like this:
<site name="FrontEnd.Web" id="2">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\xxxxx\xxxxx\xxxxx\FrontEnd.Web" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:3391:localhost" />
</bindings>
</site>
I deleted the entire site tag for this application, saved and then, right-clicked my solution > Add > Existing Project and re-added the project to the solution.

ASP.net and devexpress scheduler, works local, does not work live

Hi guys I got some code here thats buggin me.
ive managed to create a page and get it working on local host, but when i publish this to go live and nav to the web page it comes up with this error.
Could not load file or assembly 'DevExpress.Web.v11.1,
Version=11.1.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a' or
one of its dependencies. The system cannot find the file specified.
(E:\web\shafteccom0\htdocs\Calendar\web.config line 44).
Ive tried adding all the references, and i mean all of the dev express ones, including ones i dont even need.
my project is a web project using visual studio 10, asp.net,C# & .Net version 3.5
ive also tried changing the .net version to 2.0, 3.0 and 4.0 but no luck.
If you need my code let me know and ill edit this.
Many thanks
That error means that the library that your application is looking for does not exist on the server you are deploying it to (or it cannot load it with the variables provided). Does the live server have the VS2010 references installed to it?
Just making sure: Are you sure your references set to "CopyLocal"?
I think DevEx installs it's assemblies in the GAC, so your local copy may be working but not when you deploy. Have you tried looking in the bin on the publish location to see if they are actually there?

Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive

I'm trying to up load my site and I'm getting this error message:
Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive.
<compilation debug="true" targetFramework="4.0">
The site works fine on my local PC but won't open when I loaded it to my host and tried to view it online.
This typically happens when you have an attribute of targetFramework="4.0" in the web.config but the App Pool is set to run ASP.NET 2.0. The targetFramework attribute is entirely unrecognized by ASP.NET 2.0 - so changing it to 2.0 won't have the desired effect.
Contact Support / Your Administrator and have the AppPool switched to 4.0.
You could also remove the attribute entirely, however if your site was coded with the 4.0 Framework, then I'm sure something else will cause an error as well.
Registering the framework with IIS is what worked for me:
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis -i
In IIS
Click on Application Pools
Right Click on DefaultAppPool --->> Set Application Pool Default....--->>Change .Net Version to V 4.0.
open your IIS (type inetmgr in run) and change your Application pool setting,To view large this Image Right Click Image and open image in new tab
In Visual Studio menu:
Website -> Start Options -> build tab -> Select Target Framework in
Dropdown box (.NET FrameWork 4)
I was facing the same issue while publishing my 1'st web services. I resolved it by simply doing this:
Open IIS
Click on Application Pools
Right Click on DefaultAppPool => Set Application Pool Default => Change .Net Version to V 4.0. (You can also change
.Net Framework Version of your application specifically)
Hope, it'll work.
for IIS 7 try according to the given picture ... mark me helpful if it works for you.
I had to register ASP.Net in IIS to get it resolved in the Windows Server 2008 R2. Sreenshot of the commands attched below
cd /d C:\Windows\Microsoft.NET\Framework\v4.0.30319
iisreset /stop
aspnet_regiis -i
iisreset /start
%systemroot%\system32\inetsrv\appcmd set config /section:isapiCgiRestriction /[path='%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll'].allowed:True
%systemroot%\system32\inetsrv\appcmd set config /section:isapiCgiRestriction /[path='%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll'].allowed:True
I'm using IIS Express, rather than IIS.
The problem was in the applicationhost.config file located in: {solution_folder}\.vs\config\applicationhost.config.
One of the application pool entries had a managedRuntimeVersion value of "v2.0". I changed it to "v4.0", and it worked properly.
I'm fairly sure the root cause was one of the NuGet packages I had installed recently.
<system.applicationHost>
<applicationPools>
<add name="BadAppPool1" managedRuntimeVersion="v2.0" managedPipelineMode="Integrated" CLRConfigFile="%IIS_USER_HOME%\config\aspnet.config" autoStart="true" />
</applicationPools>
</system.applicationHost>
Change the application pool to target framework 4.0 instead of classic .
RC website ->manage website->advanced setting>
the first option change from classic to framework 4 integrated.
Open Project -> press Shift + F4 (Open properties page) -> Chose Build -> in Target Framework chose .NET Framework 4 -> OK
I also got the same issue while running my application locally which is pointing to .Net Framework 4.7.1.
The bug was "Unrecognized attribute TargetFrameWork" as shown below.
But none of the above answers helped me. At last when I changed my present port (1413) number to some other value(60179) as shown below it worked fine for me.But I am not sure for the actual reason behind this , but it worked.
Create a new pool by selecting .Net Framework v4.0.3xxxxx
use the Manage Pipeline Mode: Integrated
Assign it to your site and done.
To fix this problem simply click the ASP.NET Version icon in the Site Tools section of Control Panel to switch the framework to 4.0.
I had this error from a failed MSBuild compile, in a project file converted from an earlier version of VS into VS2010 and .NET 4.0. It was actually a Web Deployment project, and the solution that worked for me was adding the following entries into the PropertyGroup section at the start of the MSBuild file:
<ProductVersion>10.0.11107</ProductVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
Maybe these get automatically updated when other types of project are converted in VS2010, but they were missing from my Web Deployment project file after it was converted.
What I did:
I did change the value of Application Pool to DefaultAppPool from a previous value. You do this in the Advanced Settings (Website --> Manage Website --> Advanced Setting>.
Just had this in VS 2010.
Fixed by editing the .sln file and changing the TargetFrameworkMoniker to have the value ".NETFramework,Version%3Dv4.0" assigned to it.
If you're using IIS Express, it creates a new configuration for each site that you run, and it's bound to the url (host/port). However, when it opens a new project using the same port it doesn't refresh the configuration.
This means that if you have a project using CLR 2.0 (.NET Framework 2.0 to 3.5) running on some port and then later you open another project in the same port using CLR 4 (.NET Framework 4.x+) the new project will try to run using CLR 2, which fails - and in case it doesn't even recognize the "targetFramework" attribute.
One solution is cleaning IIS Express sites, but the easiest method is changing the port so that IIS Express will create a new site (using CLR 4) for your project.
If you compile the files and the value of the "targetFramework" is set as being a particular version i.e. 4.0,
Make sure the host is running .net framework as the same version stated.
If not, download the .net framework.
After downloading, if it is not automatic being set in the IIS manager to be using the extension of the newly downloaded version of .net framework,
add the extension manually by going to the folder of the recently downloaded .net framework THROUGH IIS manager:
1.right-click website folder
2.go to "Properties"
3.under "virtual directory" , click "configuration"
4.edit the executable path of extension ".aspx" (of which the path being pointed to version other than the version of the recently downloaded .net framework) to the correct path which is the folder of the NEWLY downloaded version of .net framework and then select the "aspnet_isapi.dll" file.
5.click ok!
Just Remove the "Target Framework 4.0" and close the bracket.
It will Work
Follow these two steps:
Register the .net framework version version 4.0 (if it is not registered)
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis -i
In the app pool change the .net framework to v4.0
If you install the IIS after the installation of .Net FrameWork. You need install the .net framework again for IIS. So all we need to do is run aspnet_regiis -i. Hope it is helpful.
Saw the error "Unrecognized attribute 'targetFramework'" in the 'Console output' page of Jenkins on a build server.
This was after I changed the 'target framework' for several projects from '.NET Framework 3.5' to '.NET Framework 4' and committed my changes.
In Jenkins the project settings had to be changed. For the solution the 'MSBuild Version' had to be changed from 'v3.5' to 'v4.0'.
Just had this issue deploying a new app to an old IIS box. The investigation led to the v4.5.1 run-time being installed but the app requiring v4.5.2
Nothing apart from installing the correct version of ASP .Net run-time was required.
It could be that you have your own MSBUILD proj file and are using the <AspNetCompiler> task. In which case you should add the ToolPath for .NET4.
<AspNetCompiler
VirtualPath="/MyFacade"
PhysicalPath="$(MSBuildProjectDirectory)\MyFacade\"
TargetPath="$(MSBuildProjectDirectory)\Release\MyFacade"
Updateable="true"
Force="true"
Debug="false"
Clean="true"
ToolPath="C:\Windows\Microsoft.NET\Framework\v4.0.30319\">
</AspNetCompiler>
For layering,
Just change the version of targetFramework in web.config file only, the other things no need change.
I had the same issue and I found this nice poweshell script to update all of your app pools at the same time:
https://gallery.technet.microsoft.com/scriptcenter/How-to-set-the-IIS-9c295a20
Make sure to set you $IISAppPoolDotNetVersion = "v4.0" variable at the top.
following 2 steps will force refresh Visual Studio and IIS Express cache and usually resolve my similar issues:
Simply switch Project framework from 4+ to .Net framework 3.5 and run it
If it ran successfully you can revert it back to your desired 4+ target framework and see that it will probably work again.
Changing the port number for the local development helped me Thanks #Rinay Ashokan.
I have done all the trouble shooting and finally found that the project configurations are stored in the IIS express for the port number.
For anyone having this who doesn't have IIS running on their dev PC, here's what happened to me: I had one website on, overwrote with files from a diff website that was 4 while the previous was 3.5. Got this error. Fixed it simply by changing the directory name of the website, which on a dev PC can be anything, so no problem.
The above are probably more elegant to be sure, but sometimes simple works, IF you can get away with it, i.e., you're in dev rather than QA or Prod.

Resources