views:

155

answers:

5

Hi folks,

I'm trying to use Visual Studio 2010 (but this also happens with VS2008) as my web server for all locahost development.

When i go into the properties for my web application (sigh, it's a legacy web FORMS app) and check the Web tab .. then check the Use Local IIS Web Server option ... it only allows me to create a virtual directory against a website.

alt text

Why?! this is not what I want :( I wanted to have my own IIS7 website (no virtual directory) and debug against that.

Can anyone help me?

As a side note, i tried to use the third option Use Custom Web Server .. which ends up pointing to my localhost iis7 server. Now, this works ... but when i wish to Start Debugging .. it errors :( (it's not sure how to attach to that process or something?)

So - can anyone out there please help?

Update

Now this is interesting. If i use Use Local IIS Web server AND have the project url set to http://localhost: ... then it works! wtf :( so why doesn't it allow http://localhost (more or less). Is it because something else might have already stollen that url?

A: 

When using IIS and Visual Studio, just set it to "Use Custom Web Server" (as you already did). Then go to your solution properties, on "Startup Project", and check "Multiple startup projects". Set both your Windows Forms application AND your web application as "Start".

The next time you "Start Debugging", VS will attach both to your Windows Forms application and to your Web Application. Note that, in order to attach to the IIS process, you must be running Visual Studio as adminstrator.

Fábio Batista
er.... that's not my problem :) i don't want to start two different apps at the same time.
Pure.Krome
Sorry, I read "Windows Forms" instead of "Web Forms"...
Fábio Batista
A: 

We do it like that:

We use the C:\Windows\System32\drivers\etc\hosts file and assign explicit names like:

  • 127.0.0.1 my-dev-page-1.com

That means that all request from the local mashine to http://my-dev-page-1.com will be handeld by your local web-server.

After that you have to configure the IIS and create a new page. You have to assign the hostheader to "my-dev-page-1.com" and set the working directory to the directory where your sources are located.

In the VS-Project you need to set the project url to: "my-dev-page-1.com"

Robert
We hack the hosts file to do all our work. ie. 127.0.0.1 dev.www.whatever.com 127.0.0.1 dev.www.whatever.com.au etc.. (we need to support multiple domains which are themed differently per domain, but show the same or similar data). And yep, we then have to assign host headers of course, just like you said.Now with your last step -> set the project url to... where/what do u mean by this? screenie?
Pure.Krome
You should use the same URL also in your Visual-Studio project as "Project URL". e.g.: dev.www.whatever.com
Robert
+1  A: 

"Use Custom Web Server" with http://localhost should do what you are trying to do. If it refuses to debug it's likely because you installed IIS after dotnet. Do the whole iis dotnet registration thing... "aspnet_regiis –i" from the .net framework folder I think.

Zarigani
A: 

First get the site running in IIS before worrying about setting anything up in Visual Studio. Use Visual studio to build the project, but then you can put it out of the way.

I don't even use the option you've screenshot'd... Once I have the site running in IIS, I use Debug menu / Attach To Proccess to attach to the w3svc process. On Windows XP the process name is asp_net instead of w3svc

Frank Schwieterman
but that sounds like a few steps :( i mean, that's what happens when u click F5/Debug in VS ... which is why i like do use/do that. hmmmmmm.....
Pure.Krome
Well, you wanted a separate website (not virtual directory) and VS wasn't letting you... Just configure it directly in IIS first. Once that working try that "Use local IIS server" option. I really doubt IIS will set up the site in IIS for you.
Frank Schwieterman
A: 

Sigh - i think i found my error.

i had a typo in the Project URL line. That needs to resolve to a hostheader of one of my localhost IIS7 websites.

if it cannot resolve to an existing website, then it asks you to create a new one, etc.

Me == fail.

Pure.Krome