Renaming virtual directory in IIS 5.1 - asp.net

I have taken a Branch of a Project from TFS. Another branch is already in my computer.
The projects contains a virtual directory which is hosted in my system's IIS (5.1) and takes path from there
After getting all files to my computer , VS 2008 says that the Virtual Directory already exists in the IIS and do I want to overwrite it?
When I select No it creates another Virtual Directory with the same name but with suffix _1
I don't like this name and I want to rename the suffix with _Branch_1
I tried by going to inetmgr and renaming the Virtual Directory -> Application Name in properties of VD.
But it does not take effect , I also saw it after browsing a test aspx file from the site , URL still shows _1 suffix.
Every time I rename the Application Name and open Visual Studio , it shows same message and adds new suffix e.g. _2 next time _3 and goes on.
Any idea how to rename it?

Check the Solution file in your project. What the virtual direcotry has defined, open it in notepad and check.
To rename the Virutal direcotry, stop the app pool associated with the application and then you can rename it.
hope it may help you.

Related

How do I prevent IISExpress & My Web Sites folders from cluttering up my My Documents folder?

I noticed recently IISExpress & My Web Sites folders are getting added to the My Documents folder on my Windows 7 machine. I recently installed VS2012, so I'm guessing that's the culprit, but I haven't been able to find anything on line that explains how to change these defaults, if possible.
Microsoft cluttering up my 'Documents' folder with all their programs' (junk) folders drives me insane as well. I have conceded somewhat by creating a Data folder under my Documents folder, where I am pointing all MS apps (and others apps such as Firefox's profile folder) to for all their (generally unwanted) folders, and with a subfolder created for each program/suite. At least this way I can easily back up all settings when I back up my 'Documents' folders.
Anyway, VS2012 installs IIS Express, which is what is causing these folders to be created. I have found two solutions for dealing with the unwanted folders.
Uninstall IIS Express. You can do this from the normal Windows 'Uninstall a Program' part of Control Panel.
Change the folder location that IIS Express uses, as follows. Be warned: anyone doing this risks causing problems with their computer if you don't know what you are doing, so you do so at your own risk. Please make appropriate backups along the way as well too!
a) Close Visual Studio.
b) Create a new folder for the IIS Express sub-folders:
eg. D:\My Documents\Data\Microsoft\IISExpress
c) Move the existing unwanted IISExpress subfolders (config, Logs, TraceLogFiles) from your My Documents > IISExpress folder to the folder created in step b).
d) Create a new folder for the My Web Sites folder, I suggest also under the folder created in step b).
eg. D:\My Documents\Data\Microsoft\IISExpress\Websites
Under this folder, create a website for the default IIS Express website (in case it "auto-magically" reappears it's ugly head again later on).
eg. D:\My Documents\Data\Microsoft\IISExpress\Websites\Default
e) Go to the newly located config folder at:
eg. D:\My Documents\Data\Microsoft\IISExpress\config, and:
i. Open the file applicationhost.config in your text editor (eg. Notepad).
ii. Find the node sites > site > application path > virtualDirectory path for WebSite1, and change the physicalPath value from %IIS_SITES_HOME%\WebSite1 to the IIS Express default website folder you created in step d).
Eg. %IIS_SITES_HOME%\Websites\Default.
Note that %IIS_SITES_HOME% points to your 'Documents' folder (this appears to be a "feature" of IIS Express, I can't find a way to change it, and it appears to be auto-configured when IIS Express starts up, which it does by using the applicationhost.config file).
Do the same for any other sites created by IIS Express.
f) Create a new registry entry pointing IIS Express to the new folders you created (partly explained by MS here: http://www.iis.net/learn/extensions/introduction-to-iis-express/iis-80-express-readme). FYI the registry key doesn't previously exist, as IIS Express uses a default of my Documents unless this key exists:
i. Open the Windows 'Run' box, eg. (Windows Key) + R
ii. Type regedit
iii. Navigate to key: HKEY_CURRENT_USER\Software\Microsoft
iv. *Right click* the Microsoft key (that you have just navigated to), and choose: New > Key
v. Type IISExpress
vi. *Right click* the IISExpress key that you have just created, and choose: New > String Value
vii. Type CustomUserHome, and hit the Enter key to save it.
viii. Double-click the CustomUserHome string to enter a value for it, and for the Value Data: field, type in the path to the new IIS Express folder you created in step b), for example: D:\My Documents\Data\Microsoft\IISExpress. Press OK, and you can now close the Registry Editor.
g) Reopen Visual Studio, and it should start using the new folders, as well as not create the folders in your Documents folder anymore. Yay!!!!!
FYI, when I did this all, I actually did it in a slightly different order (creating the registry key first), but this order was the easiest way to explain it all. Whether you create the key first or last shouldn't matter, as long as you do all the steps. Good luck!
A Tricky solution
Make a copy of your C:\Users\<user>\Documents\IISExpress folder
first
Create a symbolic folder called IISExpress inside the C:\Users\<user>\Documents folder using the following command
mklink /J C:\Users\<user>\Documents\IISExpress D:\IISExpress
Move all the content from your copied IISExpress into D:\IISExpress
Thats all
If you're just looking to declutter your Documents folder, one simple workaround is to set the unwanted folders to hidden so it's no longer visible.
You can do this by right clicking on the IISExpress folder > Properties and checking the hidden property at the bottom. The folder will still remain in your Documents folder but won't be visible to you. If for some reason you want to access these folders again, you can toggle hidden item visibility in File Explorer's View tab.

ASP.NET: debugging in same directory than publishing

I want to debug my asp.net application in same directory than I publish, so absolute paths are the same as real environment.
I try to activate use local IIS in "Web" properties but I get an error saying: I need to create virtual directory (actually it already exists in that directory) and if I try to creat it I get a cryptic error saying there is already a different folder assigned (or something similar)
Thank you
You mean to debug from the local IIS or any remote server directly right?
Close the VS. Open the .sln file in notepad, there will be a line on top like
Project("{random numbers}") = "test", "..\..\WebSites\test\", "{random numbers}"
Change the second parameter (relative path of your project folder in file system) to the address of your virtual directory. Like:
Project("{random numbers}") = "test", ""http://localhost/test/"", "{random numbers}"
Also if you are using IIS7, change the virtual directory to application.

Need help setting up simple Virtual Directory in IIS7

Noobie question...
Using IIS7, I am trying to create a virtual directory for the folder that contains my video files, but can't get my head around how it is done.
For example...
The existing address is http://www.mydomain.com/members
which points to C:\wwwroot\mydomain\members
I need http://www.mydomain.com/flash-members to point to the same path.
The existing IIS path to the members folder is Server\Sites\www_mydomain_com\members (has application icon)
Any help is appreciated.
For your example, assuming www_mydomain_com is the Site (little world icon), you can do this by:
Open IIS Manager
Right-click the web site, select Add Virtual Directory
In the Alias field, enter flash-members
In the Physical Path field, enter your path (C:\wwwroot\mydomain\members)

Confusion Deployment of website on the IIS

I am a noob. I am learning to develop and deploy small websites on the IIS server. Now i have the following confusion :
I think procedure to 'add' a website to the IIS server starts from adding a new virtual directory or adding a new website in the inetmgr. Please correct me if i am wrong. I also think that once we have done this .. it is mandatory to add the source of the project to the inetpub/wwwroot folder. Am i correct ? Is it always necessary to do so ? I am worried because in that case how can we run multiple websites ? Also .. say i have added a virtual directory to the inetmgr ... now what do i do to run my website ... i am trying but getting "Directory Listing Disabled" written on the browser once i type http:\localhost....\Default.aspx
No, the source does not need to be added to the Inetpub folder.
You can simply add a new virtual directory pointing to the location of the site.
(Make sure the selected location is the folder containing your Default.aspx page)
If all other settings are correct, you should be able to hit the site at
http://machineName/virtualDirectoryName/
For this address to work, make sure you are allowing default documents, you may have to add "Default.aspx" to the list depending on your IIS version.

How can I manually override the IIS Directory for an ASP.Net project opened by VS2008 but created on another machine?

I have an ASP.Net project created by a team member on another computer. The project references a virtual directory that exists on my computer but under a different localhost location.
Currently, the following error occurs when I try to open the project:
The local IIS URL http://localhost/foo/default.aspx specified for Web project foobar has not been configured. In order to open this project the virtual directory needs to be configured. Would you like to create the virtual directory now?
[Yes] [No]
So, there are two options:
select yes: It creates the virtual directory that it thinks I need, which I don't want to do. I already have a virtual directory somewhere else.
select no: This isn't an option, as the project opens, but without all the bells and whistles I know and love.
Where is the virtual directory location (in my case http://localhost/foo/default.aspx) specified within the project? Can I change this manually, say in a configuration file within the project, either before or after I open it? A configuration change seems more ideal than manually opening IIS to override a virtual directory path.
EDIT (solution): Buried in the comments below is the following answer (Thanks #Thyamine)
This can be configured in the foo.csproj file for the project.
Look for the lines:
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{F00-000-000}">
<WebProjectProperties>
<UseIIS>True</UseIIS>
<!-- ... -->
<IISUrl>http://localhost/Foo/default.aspx</IISUrl> <!-- EDIT THIS LINE -->
<!-- ... -->
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
You could allow it to create the directory, then re-map it in IIS Manager to point to the directory you would prefer it to use.
Or you could tell it not to map at all, and then manually create the virtual directory with IIS Manager to the directory you already have.

Resources