VS Crashing after 'Set As StartUp Project' - c#

I have a solution in VS 2012,
I try to change the startup project to specific project but the vs crashing immediately (with the other projects - no problem)
with the familiar message "Visual Studion Stop Working.."
I try also to define the startup project manualy in the .suo file
(See details in Why is "Set as Startup" option stored in the suo file and not the sln file?)
But when i reopen the VS, it crashes during the assemblies loading.
Any idea what can be the cause?
Edit:
Additional Details:
Its solution contains also WCF project, run in front of local IIS, This project run perfectly, with the same code, in other team computers.
As result of the facts, It seems an environment problem, IIS setting, Permissions and etc.
Note that i already reset VS setting, and also repair the installation and the problem not resolved.
Maybe someone knows what the logical action of 'Set as startup project', what the VS perform during the action except for the start point definition? i think that the root of the problem hides there...

I had this problem too, but on VS 2015. You should logoff from your MS account from VS, set your project as startup and then login back if you want ...

It is hard to guess what the problem could be, but because it works on other team members' machine, it might have something to do with your Visual Studio state.
Try clearing or moving out all files from:
C:\Users\<Username>\AppData\Local\Microsoft\VisualStudio (if starting as admin)
C:\Users\<Username>\AppData\Roaming\Microsoft\VisualStudio (if not starting as admin)
You might need to restart your machine if the files are in use before you can delete/move them. These folders contain some VS settings, cached files and logs.

In addition to what AVS said, you can try deleting your Visual Studio .suo file.

Related

"Error while trying to run project: Unable to start program". Can run program only once. Then VS needs restart

I'm running my .NET 4.0 (C#) project in debug mode after I start VS2013. It runs just fine.
The second time I start it from VS, I get the Dialog box that says "Error while trying to run project: Unable to start program C:\path\to\file.exe"
The process is still alive in the Taskmanager when I dismiss the dialog box.
From Windows Explorer, I can run the program just fine. And after closing it, the process is gone too from the Task Manager.
A rebuild doesn't help.
Is this a common problem with a known solution?
I had an issue similar to this and I had to clear the component cache instruction can be found Here.
Hope this helps.
For my case, it cause by Platform target, you could force choose it to x86 or x64 which your project is:
Each Project's Properties > Build > Platform target
As I pointed out also here, the only solution that worked for me was to disable the ConEmu integration:
ConEmu &rightarrow; Settings &rightarrow; Integration &rightarrow; Default term &rightarrow; disable Force ConEmu as default terminal for console applications
Some users reported that it was enough for them to disable the Aggressive mode in that same settings tab; that wasn't the case for me though.
The topic is old, but this might help someone else.
So in my case I made a file in Visual Studio with .cp extension (accidentally deleted the last 'p') this made visual studio just "include" the the file and not mark it as a compilation unit, thus not compiling it, I looked the *.vcxproj file in a text editor and found out about this, so if you open the project file in a notepad or something just find your file at the bottom usually and change from <Item .../> to <ClCompile .../>
I was getting similar errors. I just had to restart visual studio. Sometime couple times a day.
I had a similar error and resolved it by cleaning the solution. Right-click the solution name in Solution Explorer and choose Clean Solution.
I found a solution here:
Please check "Use Managed Compatibility Mode" under Tools|->Options->Debugging->General.
I'm Brazilian, I don't speak English very well. I did this translation on google translator.
I know the topic is old, but it can still help someone.
I had this same problem in the following situation, I have a dual boot computer (linux debian 11 and windows 10). Inside debian, on my NTFS D disk, I created a folder to perform programming tests. After accessing that same folder with windows, I created a new project in visual studio inside that same folder that I had created in linux. The creation of the project went without problems, however when I tried to run the project (F5), I received the same error from this topic. I tried all the solutions I found on the internet, and nothing worked. I gave all permissions to my admin user and it still didn't work. Then I realized that even going straight to the folder where the application's executable was and clicking directly on it, I still received the access denied error message. So, I took the project out of the folder I had created in linux, and it worked. So, what I could conclude, is that because the folder where my project was was created in linux, for some reason, my windows didn't trust this folder, so it didn't allow running executables from inside that folder, even this one executable having been created by visual studio from within windows.
Just simply create a folder name as "projects" in c drive and copy paste the newly created project in it. Run the project by doing clean & Build or Rebuild method . It will work
open the folder which contains the solution in visual studio.
again, open your *.sln file by double clicking it inside the solution explore once opened try running the solution or rebuild the solution. once rebuild gets completed, it will open without error from next time.
My way of solving the error : error while trying to load project : Unable to start program and c:\Path\to\file.exe was simply by
First restart Visual Studio
Click the build icon
Select the rebuild option
Run the Program or Debug the Program
This was a weird one. Going to put what happened to me here because it might happen to someone else. Everything was fine with the app until suddenly after some fairly insignificant code changes I suddenly started getting this error. Visual Studio was compiling the executable just fine. But, the moment I tried to run it (either from Visual Studio or directly) the executable file would be automatically deleted right out of the Debug folder. Super odd--never seen anything like it. I began to get suspicious that perhaps an anti-virus or the OS was somehow identifying a checksum or some signature in the executable as "dangerous". Or perhaps some obscure compilation bug was corrupting the executable. So on a hunch I made another innocuous change (added a couple of lines of code to color code some text in a rich text box) and the problem went away.

The Operation could not be completed. The system cannot find the path specified

I created a C# Website using Visual studio 2015 in my laptop, i copied the same folder to my desktop system and open in Visual studio 2015, when i try to run the application its suddenly gives following error.
The operation could not be completed. The system cannot find the path specified
Anybody feel same error in your latest Visual Studio 2015? I updated all the latest patches.
following trial are done
Re created the soluition file(.sln)
Deleted Web.config and added new one
Still the error exists, so i cant able to debug or run the application.
(1) Run VS as an admin (or elevated access) and open the solution.
(2) Set up a project as Start up Project (if you have multiple proj)
(3) Set up page as start up page.
this should help you run it
Create manually (Windows Explorer if necessary) a folder with name "Service References". Even if the folder does not appear in the Solution Explorer, is there.
Try adding the wsdl (xml) file again.
I had the same problem, resolved by creating a Connected Services folder in my project.
So juste create a Connected Services folder or a Service References folder in your project
I experienced this error. When I shorten the file path of the solution, the error disappear. I think you may put your solution to a folder with too long path name or your solution have some file with too long name.
I got a more specific project-load error message when I removed the project from the solution and tried to re-add it. In my case, it was because the URL/address of the application had changed in my local IIS. When I updated the tag in the .vbproj (or .csproj) file to the new value, then the project loaded successfully.

Unable to start debugging. The startup project could not be launched. VS2015

I have started a new console project in VS2015. I only have this code :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SautinSoft;
namespace PdfParser
{
class Program
{
static void Main(string[] args)
{
string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
SautinSoft.PdfFocus f = new PdfFocus();
f.OpenPdf(#"path:\abc.pdf");
if (f.PageCount > 0)
f.ToExcel(#"path:\abc.xls");
}
}
}
When I try to run, I get this :
Unable to start debugging. The startup project could not be launched.
Verify debug settings for the startup project.
How can I fix this? Thanks.
After upgrading MSVC2015 to Update3, I had the same problem: instead of std::map in the Watch window display as a horrible std::_Tree<std::_Tmap_traits... etc., some plugins started to throw exceptions, some projects was not able to run in debug mode.
All was solved by deleting CurrentSettings.vssettings. It is usually located at Documents\Visual Studio 2015\Settings If not, go to `Tools -> Options -> Environment -> Import and Export Settings ' to find the location of this file.
Had this on a brand new scaffolded ASP.NET Core 1.0 web application.
Solved with restart of Visual Studio.
I was also stuck with this. I removed both bin & obj folders, did a rebuild, and then it launched.
A very meaningless error....
I had this problem when I tried to start (without) Debugging my Asp.Net MVC project
are you running Visual studio as Administrator
so just restart visual studio As Administrator
Additionally to "Unable to start debugging"
I also had errors "The operation could not be completed: Unspecified error" when I tried to rebuild.
Thanks to Visual Studio popup: "the operation could not be completed"
it was enough to close Visual Studio 2015 and then open again.
Make sure you're launching Visual Studio as Administrator.
Right click on the Visual Studio 2015 Shortcut
Select the Shortcut tab
Click on Advanced
Check the box to "Run as administrator" at all times(see below)
This has resolved the issue for me with the exact error message in question.
It is not ideal to run the VS in administrator mode at all times. Make sure you un-check the box once your issue has been resolved.
There is no need to delete everything in my case, I just opened the
"CurrentSettings.vssettings"
file and commented this property
<PropertyValue name="DefaultBehaviorForStartupProjects">1</PropertyValue>
and everything fixed.
Sample
Just delete the .vs hidden folder. This folder resides at the same location where the sln file is. Deleting this folder also refreshes intellisense cache and would fix any issues with that. Hope this helps.
VS 2019, two Core 3.1 projects (an MVC and an API), brand new projects created, no other changes to the solution or projects.
I kept getting the referenced error when trying to start both projects within the IDE, despite having checked all the things already mentioned in this SO.
However, I finally realized, I forgot to specify the "Action" after switching the solution to "Multiple startup projects" (they were both still set to "None"). Right-click solution in "Solution Explorer", choose "Properties" (at very bottom).
Such a ridiculously simple thing. Hope it helps someone else.
"Broken"
Working
I just had the same problem and solved it by deleting the .vs directory in the project directory.
Delete all relevant /obj and /bin folders. Run again.
Close the Visual Studio and re-open it again.
Just restart your visual studio and run as admin.
I had this with a Xamarin.iOS project in my Xamarin.Forms solution. I tried every suggestion here, without success.
The source of the error was a misconfigured .csproj of the project. I never edited it myself and not even touched the project properties. I use Visual Studio 2017 RC.
I came across the solution when I compared the project file with previous versions on Source Control.
Solution: Compare the project file with a previous version and try to granually revert changes until you eliminated the problem and know what the cause was.
The solution for me was to delete all *.user files that are normally generated for both solution and project files
I found this problem too. But after restart the Visual Studio Community 2015 as an administrator I found new problem :
And then I try to open another solution, close the another solution, and open the solution which the problem occur, then the problem solved.
Had the Same Issue with the existing application, I deleted the vs settings but still the issue remained,
Finally i just restarted the VS and it worked fine.
I think sometimes when we load the project some library doesn't get loaded with the solution so the best option before doing anything is simply restarting the VS.
After adding a project reference 'MyProjectReference' to my app, then removing it, I was also getting the same error :
Unable to start debugging . The startup project could not be launched.
Verify debug settings for the startup project.
Deleting configuration, running as admin, restarting VS, rebooting machine all had no effect.
After running my web app without debugging (Right-Click Project -> View In Browser (Google Chrome) I got a much more useful error:
Could not load file or assembly 'MyProjectReference' or one of its
dependencies. An attempt was made to load a program with an incorrect
format.
My Solution was then to re-add back to the solution, then remove it again. After that rebuild and debug worked.
How I fixed my issue, I closed project that had that error , created new project build new project then opened the project that had an issue and build it. That worked for me.
Make sure you close all instances of Visual Studio and then restart as Administrator. In my case I had multiple instances of Visual Studio open and I had to close them all and then restart Visual Studio as admin in order to get things working.
I had visual studio 2015 with an ASP.net MVC5 arcitectured with DDD (Domain Driven Design). The problem was the same since I just opened visual studio normally.
The problem was solved when I closed all instance visual studio and restarted as an adminstrator.
I also faced to this issue in VS 2015 , but finally I resolved it by following bellow steps
In VS go to : Tools -> Options - > Projects and Solutions -> Build and Run
Select "Always Build" in "On Run when project are out of date"
This issue happened to me with the Latest VS2019.
I've tried everything here, but unfortunately without any result.
Finally, I've restarted the IIS server, also manually Recycled the "Default Application Pool".
After debugging issue fixed.
For me solution was to run testapp.csproj instead of testapp.sln. This can be selected from drop down next to green play button.
Simply updated visual studio which then prompted PC restart. This is what fixed the problem for me.
Note: I tried some of the above / below but to no avail.
I got this problem solved by clearing MEF component cache.
Use this VS Extension to clear cache very easily.!!
I stop debugging and exit the projects from IIS Express then clean and build the project and my error is gone.
I get this running as non-Adminsitrator in Visual Studio 2019 16.2.5, with two .NET Core projects.
The solution I found is to set at least one of the projects as "Start" (in Solution's Property Page). If both are set to "Start without Debugging" it fails. This happens even if I want to start the entire project without any debugging (Ctrl+F5).
Bug. Still unaddressed by Microsoft and their bug page issue report it is closed as unreproducible.
#Flowerking's commend did it for me.
Right click on you project and select "Set as StartUp Project".
I had this problem developing a react native app for windows in Visual Studio 2019. I started the debugger then stopped it in the terminal by using ctrl-C. I was not able to restart the debugger and the "start debugging" and "start without debugging" options were disabled in the debug dropdown. Restarting Visual Studio, etc, and some of the things described above did not work. Through hunting and testing, I noticed that if I switched views in the Solution Explorer to the MyProject.sln instead of the fileview, the debugging was enabled again. I'm not sure why, but it appears I need to be in the sln view to start the debugger.

Visual Studio Setup Project not removing DLL

I have a problem regarding the Visual Studio Setup Project and uninstalling an application.
This is a very basic installer, installing an ApplicationLauncher.exe C# .NET 4.0 console application and an Application.Common.dll (a dependency of the application ApplicationLauncher.exe).
The installation is a success, copying both the exe and DLL into the program files folder C:\Program Files (x86)\Company\ApplicationLauncher\.
My problem comes when uninstalling the application (through the MSI) - the uninstall seems successful, however it leaves Application.Common.dll behind, and doesn't remove it as I would expect.
I've used ProcessExplorer to make sure nothing else is using the DLL, no explorer windows are open during the uninstall.
Is this the expected functionality and do I have to create a custom action to remove this DLL? Or have I done something wrong? :S
It seems I was able to fix this issue by renaming the solution and product name of the application, I'm not sure how this fixed it, but it did.
My only thoughts here is this traversed through to the installer, where the application installed into a different folder, thus not applying the same permissions to the DLL..
It's not expected, no. It will happen if you ever done any of the following with your setup and installed it:
Marked the file Permanent.
Marked the file SharedLegacyFile true.
These are project settings, but if you set either of them and do the install it will stay behind. You can unset them in the setup project but that's too late - you've marked that component permanent or sharedlegacy on the system. If you use a brand new system, like a fresh virtual machine, reset these values if they are set and rebuild the MSI and do the install/uninstall does it still happen?
I had the same problem. Then I have tried to install and unistall my app on Windows XP and that had worked.
Renaming the ProductCode is treating the symptoms not the cause. The problem occurs when the uninstaller doesn't remove the dll. The next install will use the dll again and can't remove it on an uninstall event because it's still used by the other program.
These steps hopefully solve the problem:
Install your Software
Open CMD (with admin privileges) and run:
msiexec /x {ProductCode} /L*V "C:\CustomPath\FileName.log"
The ProductCode can be found when hitting F4 on the Setup Project
Open the log file and search for the lines that look something like this:
Disallowing uninstallation of component: {6CEC09F6-9108-7062-A692-2BCBACEE3BD8} since another client exists
Disallowing uninstallation of component: {A0A0FA84-CC0D-C5C4-1F57-169788C4482D} since another client exists
Disallowing uninstallation of component: {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} since another client exists
All these components have to be removed from the registry by hand. To do this the GUID (e.g. {6CEC09F6-9108-7062-A692-2BCBACEE3BD8}) first has to be converted into a packed/compressed GUID (e.g. 6F90CEC6801926076A29B2BCCAEEB38D). I found a Website where one can run a script to do this. Find the following code on the website and replace the right side with the GUID from the log.
string inStrGUID = "{6CEC09F6-9108-7062-A692-2BCBACEE3BD8}";
Open the registry (as an administrater) and search (Edit -> Find...) for the compressed GUID (uasually it's somewhere in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\)
Delete the folder that is equal to the compressed GUID. The values inside the folder should be a path to the dll.
Once deleted select the parent folder (...\S-1-5-18\components) and hit Edit -> Find...
Repeat these steps (4-7) for all components from the log file.
It's also a good idea to delete all files still present in the original folder that weren't uninstalled.
Can one prevent this from happening?
I don't know. This really isn't that easy to reproduce. Some other post on SO have suspected the install/uninstall option in Visual Studio to be the cause of the problem but I have a different theory:
This bug might be the result of RemoveExistingProducts in InstallExecuteSequence in the Setup being executed too late and therefore not removing dlls at the right time. This bug is known for years and can be fixed by doing this. If you need help with Orca this explains how to install it.

Error - Unable to access the IIS metabase

After installing Visual Studio 2012 and opening my solution I get a series of errors in this form:
The Web Application Project Foo is configured to use IIS.
Unable to access the IIS Metabase. You do not have sufficient privilege to access IIS web sites on your machine.
I get this for each of our web applications.
Things I have tried:
Running Visual Studio as Administrator
Running aspnet_regiis.exe -ga MyUserName
Running aspnet_regiis.exe -i
These seem to be common solutions for this problem but I have not had any success with them.
Is there anything else I can try to do?
On Windows 8 Pro:
%systemroot%\inetsrv\config
On Windows 7 and 8.1 and 10
%systemroot%\System32\inetsrv\config
(Where %systemroot% is usually C:\Windows)
Navigate to the appropriate location above in Windows Explorer. You will be blocked access with a popup which says:
"You don't have access to this folder - Click continue to permanently get access to this folder"
Click 'continue' for this folder, and with the Export folder underneath. I changed the shortcut back to "Run as me" (a member of the domain and local administrators ) and was able to open and deploy the solution.
I think you are not running visual studio with administrator permissions. Look that:
http://bloggingabout.net/blogs/rick/archive/2012/10/04/unable-to-access-the-iis-metabase.aspx
To quote
The solution to this is simple: start your Visual Studio with "Run as
Administrator". You can do this by right clicking the shortcut and
selecting "Run as Administrator".
I think we encountered a similar problem at work. For us, the solution was to go into Control Panel -> Programs and Features -> Turn Windows Features on or off... inside that, we had to select Internet Information Services -> Web Management Tools -> IIS 6 Management Compatibility -> IIS Metabase and IIS 6 configuration compatibility.
Give that a try and let me know if it helps!
Note: We're running IIS 7.5 on Windows 7 using both Visual Studio 2005 and 2010 and doing stuff with super-old-school WebServices (.asmx)...
I resolved this issue by granting IIS AppPool identity permissions to the %systemroot%\inetsrv\config
If you are working on a project which does not require the use of IIS, then a workaround to open the project with this error is to simply right click on the unloaded project and click edit, search for:
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="">
<WebProjectProperties>
<UseIIS>True</UseIIS>
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
</Project>
and set USEIIS to false
<UseIIS>False</UseIIS>
reload the project by right clicking on it after saving changes.
I have had two seperate types of problem lead to this error, and thought I'd share...
1. The directory was on an network share and due to UAC restrictions, was
unable to be accessed -- even when running as an admin.
2. The directory was on a drive that didn't exist...
Both of these stem from an unfortunate (imo) choice by MS to put things in the Documents or My Document directory, combinee with really lousy error messages. In both of the above cases the fundamental problem was that the IISExpress Config file goes in My Documents, and it either didn't exist or couldn't be accessed.
Thank you to everyone that answered. Since this was closed for a long time I couldn't provide much feedback, but I did eventually fix my problem. I tried many of these other solutions and they didn't fix my issue, but I'm sure they help when the root cause is different.
My Solution
I solved this problem by turning off the IIS and .Net Framework features within Windows 7 and then turning them back on. It seems like this re-installation is what fixed my issue. I still don't know what caused the problem, but at least one other developer on my team had the same issue.
Navigating to folder: %systemroot%\System32\inetsrv\config presents a security dialog. Click continue and this may resolve the issue. This has worked on two separate Win 10/VS 2017/IIS machines.
On a windows 81, from an admin command prompt, use:
icacls "C:\Windows\System32\inetsrv\config" /t /grant "IIS AppPool\DefaultAppPool":(R)
Then go back in VS, right click on the failed project, choose Reload.
Credit to: IIS7 Permissions Overview - ApplicationPoolIdentity
I had this problem - the symptoms were the same, but the issue I had was that I had set the "My Documents" folder to be on a network share, and the share was not accessible.
The root problem was that the IIS config files located at %USERPROFILE%\Documents are not accessible. Once I changed the "My Documents" folder location (I modified the reg value), it started working again.
I know that this may not be a common scenario that you might run into, but I've posted it here because it gives the same symptoms.
I came across this today and fixed the problem by removing the IISUrl from the Project file:
Right click project
Click Edit
Delete the following line:
<IISUrl>http://localhost:xxxxx </IISUrl>
Reload project
Now add a new IIS virtual directory by right clicking Project > Properties > Web and selecting Use Local IIS Web Server (Uncheck Use IIS Express) and clicking the Create Virtual Directory button.
You might run across this problem and have same problem as me. I "solved" it before and then power outage and computer crashed, not sure why a registry setting reverted but it is the SOURCE of my problem.
I tried all the running as adminstrator
All the IIS / IIS express re-installs.
Various "hacks"
Came down to having to fix the registry again.
Could not as administrator even open regedit (Need to access registry since problem is not with gpedit.msc admin template )
UnHookExec.inf on desktop
Just save UnHookExec.inf and install it by right clicking and selecting install. Installing the file will not show any popup or notice box.
http://www.tweakandtrick.com/2011/04/enable-regedit-registry-editor.html
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Personal pointing to non-existant fileshare. Changing that to local path solved this problem for me. – Pasi Savolainen Jul 14 '14 at 8:41
(changed from \\cs2data\home\stickelt\my documents to c:\dev )
Now ALL is good and Visual Studio opened solution with 15 projects and connects to IIS and does not complain about not being able to access iis metadata
I had never ran into this before, as nobody at current job had this problem ( many have been here a long time, some got clones of other machines that "worked" and many are on another domain etc.. )
I just had this issue today and I found that I didn't open VS as 'Run as Administrator'.
After doing this, I was able to publish the Service.
If you have administrator permissions, Right Click to Visual Studio icon > properties and then advanced, "Run as administrator" check.
You can run visaul studio as administrator directly anymore.
This way, formal and so basic.
In addition to the answer by #nologo, I also had to use IIS. So I changed the
<UseIIS>True</UseIIS>
to 'False' first.
Opened the solution and ensured that the project could be loaded.
Close solution and that instance of Visual Studio
Change the value to 'True' again
Open the solution.
This time, I didn't get any error/warning. I could also run with Ctrl+F5 or F5 without any problem while my project was mapped to an IIS website.
Changing this key worked for me:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Personal
The location didn't exist.
Go to the root directory of your project and find the following file:
YourProjectName.csproj.user - inside it, make sure UseIISExpress is set to false:
<UseIISExpress>false</UseIISExpress>
If that alone doesn't work try the following as well and try again:
YourProjectName.csproj - inside the main project file, make sure both UseIIS and UseIISExpress are set to false:
<UseIIS>True</UseIIS>
<UseIISExpress>false</UseIISExpress>
After changing these I was able to load the project again.
Note: Make sure you run your VS as an Administrator, as mentioned in the other answers.
I also had a similar problem. My solution is an extension to the answer "Run as admin" which I hope someone might find useful.
I was running VS2012 and almost every time I had to do the Right Click, Run As Administrator. I got tired of this so instead I went into its properties on the shortcut, clicked advanced, and then clicked the "Run as Administrator" option. Now VS2012 always runs as administrator whenever I open it from that shortcut.
The from that shortcut bit is important. I proceeded to branch my project, and download the branch to a new local folder. Then, when I opened it from the shortcut I had no problem. But if I went directly into the folder, and ran the project locally without the shortcut, it did not run as administrator and I got this error.
Once I opened VS2012 as usual first, then using File/Open/Project It worked again no problem. (because I was running as admin). But I wasn't running as admin when I opened the solution using windows file manager.
The other suggestions seem somewhat extreme, but this is pretty simple so I would tend to give this a try first.
Hope this was helpful.
This seems like one of those "All errors lead to this message" type of bugs.
Mine was that the App Pool was just turned off. I turned it back on, and everything worked fine.
One more thing you could try:
Check if you have pending Windows updates.
If you do, please reboot before trying anything else.
I tend to never shut down my machine, so I had plenty of them waiting for a reboot. And that fixed it.
I tried everything above. The credit goes to all of the responses above. Having tried all of the suggestions on their own, I just assembled this combination of suggestions in an order that made sense to me. Note my Documents folder is on a shared drive. The subst/IISExpress stuff is not applicable unless you're in the same boat.
Configure VS to run as admin
Uninstall IIS via Add/Remove Programs, Windows Features
Reboot
Run WinRAR or something similar as admin and archive C:\windows\system32\inetsrv\
Run cmd as admin and rmdir /s c:\windows\system32\inetsrv\ to completely remove all traces of the last install. Leave elevated cmd prompt open for later.
Reinstall IIS with IIS 6 Metabase compatibility (doubt this was necessary)
Leave Default AppPool and Default Website as-is (I had previously deleted both)
Ran C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -ga MYDOMAIN\scottt732
Ran C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i
Also, because my Documents folder is on a share drive, I was having IIS Express issues. I don't use/like IIS Express, but Visual Studio complained about it.
From elevated cmd prompt, ran subst U: c:\Temp. Created C:\Temp\Documents\ and copied the IISExpress folder from my U drive.
Created CustomUserHome key in HKCU\Software\Microsoft\IISExpress with C:\Temp\Documents\IISExpress
This allowed me to get Visual Studio to open my web projects and edit the properties. I tweaked the projects to store web server settings in a user file and adjusted it to use a Custom URL (not sure if this was necessary)
I may/may not have to run the subst command each time I restart. Don't care.
And after throwing in the towel 3 times and spending roughly ~6 hours I can open web projects in Visual Studio (2015 Update 2).
I just had the same issue with me today. And I found it annoying. Though I have other two websites already under development from the same IIS but still was not able to create new site. Strange, but I did this.
Delete the site from IIS
Create new site, give it a name "new_site"
Select Application Pool other than the site name itself. So it wont be messing up with default settings.
Keep IP "unassigned" if you are running it from same machine
give it some unused port
Run Visual Studio as "Run as Administrator" by right-clicking on VS executable shortcut.
You are done!
You do not need to turn off/re-install anything other than what I have stated since it works.
Let me know if anybody had the same issue just like me and solved the same way. I think it was not the issue but a wrong way of creating website on localhost which Visual Studio rejects to open.
I hope this will help newbies.
Create a shortcut to the "devenv.exe"
select the "Run as administrator" option for the shortcut
doble click on the short cut and reopen your project
I had the same problem after Adding feature from this link afterward I followed this article the issue was gone.
I did a repair of Visual Studio 2015 to solve this.
The repair took a long time, but it solved the issue while doing much of the above did not. I am running Win 7 enterprise.
Open visual studio command prompt and type below command and run
aspnet_regiis -ga machinename\ASPNET
After running the above command Reset the IIS and test the application that resolve your issue.
If above command doesn’t resolve your problem then try to run below command in visual studio command prompt:-
aspnet_regiis -i
Alternatively we can run above command from our windows command prompt also
Go to the Start menu and open Run and enter and click OK
%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe –I
After that Reset the IIS and test the application that resolves your issue
In Visual Studio 2015:
I changed UseIIS in .csproj file to false and it worked for me.
<UseIIS>False</UseIIS>
In my message, beside complaining about "Unable to access the IIS metabase", it also mentions can't access "<IISUrl>http://localhost:6416/</IISUrl>". Right click on the unload project, click Edit, find the line "<IISUrl>http://localhost:6416/</IISUrl>", comment it out. Reload and it should work. This has to do with administrator doesn't have permission to access that address.
I had a similar problem. Visual Studio would not load any web projects and showed the error: creation of virtual directory <myproj:myport> failed. Unable to access the IIS metabase.
In my case it was actually IISExpress that was at the root of the problem. Right clicking on IIS Express in Programs and Features in the control panel and choosing repair fixed the issue in less than two minutes.
I'm using Win 8 Pro and VS 2013.
After trying everything in this page... I simply reinstalled IIS Express 8 and everything works fine now (even without running as an admin).
My conclusion is that this is a rather generic error and there are multiple root causes.

Categories