We help IT Professionals succeed at work.

Why are my web services not visible within a virtual directory?

Medium Priority
Last Modified: 2013-11-19
I have an ASP.NET project that has several web services which are called from javascript files in the same project.  The code behind for the services is in the appcode folder of the project and the .svc files are in the same folder as the javascript which calls them.

I have created an install that creates a website and a virtual directory.  If I browse to the page that uses the web service using the virtual directory, the web service call fails.  However, if I set the home directory of the website to the same physical directory as the virtual directory, then browse to the page using the home directory of the website, the web services work.

So, for example, if I use the following address the web services fail:
If I assign the home folder of the website to match the target of the virtual directory, it works:

Any ideas?
Watch Question

Praveen DMInfra Team Lead
Top Expert 2008

Does it happen even after enabling this option in IIS for the site and the VD..



Yes.  I enabled parent paths on both the website and the virtual directory and the problem remains.


I have noticed that the application "starting point" differs between the website and virtual directory.  Could that be the reason that the website path works and the path using the virtual directory does not?  Is there a way to change the starting point for the virtual directory?
Praveen DMInfra Team Lead
Top Expert 2008

IIS 6 can have multiple sites created and ...

As u said..try to create or map that virtual directory as with the desired link path and u will be access them accordinglly...


Does anyone know how to do that?


I have discovered the cause of the problem.  I was running precompiled code.  After deploying the regular source code to the server, the problem clear up.  Now the question changes: Why would a precompiled web service not work inside a virtual directory?

 I used the following command to precompile:

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727>aspnet_compiler -p "<filepath>" -v / "<destination>"

 It may be worth noting that this application runs on the .NET 3.5 framework and I notice that the precompiler seems to be for asp.net 2.0.


Does anyone know why a precomplield web service would not work inside a virtual directory?
I have found that if I run the precompilation utility in Visual Studio 2008  rather than from the comand line, the precompiled web service runs great under a virtual directory.

Old way:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727>aspnet_compiler -p "<filepath>" -v / "<destination>"

New way:
In Visual Studio:
Build --> Publish Web Site --> uncheck "Allow this precompiled site to be updateable"

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.