Search code examples
visual-studiowcfvisual-studio-2010iisiis-7

How do I run (debug) WCF REST Service application on local IIS7 server


As the question says, I have a problem running the web app on local IIS.

Here is my situation:

  • WIndows over Oracle VM VirtualBox running on Linux Ubuntu.
  • Bridged Adapter so that Windows box gets local IP from my router.
  • Visual Studio 2010 + sp
  • WCF REST Service application plugin for project template
  • The application runs when using visual studio development server (on localhost).
  • Target framework is v4.0

What I need is that the application runs on IP instead on localhost (so I can consume it on remote computer in LAN), so I configured IIS7.

Here is IIS configuration:

  • I created a website with target framework v.4.0
  • I binded the site to my local IP on port 80
  • Path to the site is /inetpub/wwwroot iisstart.htm as default document
  • IIS runs ok. If I open "http://my_local_ip" I get the welcome logo.

The problem is in visual studio.

When I go to project properties "Web" section and select local IIS over vsd server is where I get lost. If I set "Project URL" to "http://my_local_ip/some_name" visual studio complains that it cannot find IIS server and so it was unable to create the virtual directory. I tried manually adding virtual directory in IIS manager, but no effect. If I use "http://localhost/some_name" as the "Project URL" the virtual directory gets created, but it makes no sense does it?

Could some one please enlighten me?


Solution

  • If I use "http://localhost/some_name" as the "Project URL" the virtual directory gets created, but it makes no sense does it?

    I think you are mixing two different things here. When you ask VS to use localhost as the IIS Server for your project, it will connect to the local IIS to perform configuration tasks. If you ask VS to use "my_local_ip" you are telling VS that you IIS Server is remote, and therefore VS will use remote administration to configure IIS (VS can't know that my_local_ip is the local computer).

    But remote IIS admin isn't enabled on a default WinServer box. Furthermore, it would require some additionnal network config. You should therefore tell vs to use the local server.

    In fact, IIS site bindings and VS deployment parameters are too completely different things. So, deploy your site on http://localhost/your_site.

    However, I don't really like the prospect of using VS debugging deploy to deploy a real app. The directory will contain all your project files... You should:

    1. create your site on IIS manager and setup a virtual directory.
    2. Either
      • ask VS to publish the site to a directory (your virtual directory)
      • ask VS to publish a WebDeploy package, then ask IIS manager to import the package.