Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

  1. 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.
  2. 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>
like image 397
Peach Avatar asked Feb 25 '11 17:02

Peach


People also ask

How do I open an ASP NET project without Visual Studio?

To run the application without opening Visual Studio, You need to install IIS (as rtpHarry has suggested). Then You need to have your application in a virtual directory. To create virtual directory perform following steps: Type inetmgr at command prompt -> Click OK.

How deploy MVC application on local IIS?

Right-click on your ASP.NET MVC5 application inside Visual Studio and then click "Publish". Now, select the "IIS" option from the left menu and click "Create Profile" button. Change your publish method to "Web Deploy Package" and provide your package location, then click "Next". Click "Save" on the next screen.

How do I create a virtual directory in Visual Studio?

In Visual Studio, on the File menu, click New and then click Web Site. In the New Web Site dialog box, click Browse. In the Choose Location dialog box, click the Local IIS icon. You must be a member of the Administrators group on the local computer to access the IIS metabase and create a virtual directory.


1 Answers

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.

like image 96
Thyamine Avatar answered Oct 06 '22 23:10

Thyamine