We help IT Professionals succeed at work.

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

Medium Priority
251 Views
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:
http://localhost/VirDir/myFolder/page.aspx
If I assign the home folder of the website to match the target of the virtual directory, it works:
http://localhost/myFolder/page.aspx

Any ideas?
Comment
Watch Question

Praveen DMInfra Team Lead
CERTIFIED EXPERT
Top Expert 2008

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

http://3.bp.blogspot.com/_r-ZWO9cNYNA/R7tnFwkuYpI/AAAAAAAAABs/J03sbY6DPl8/s400/Enable+parent+paths.jpg

Author

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

Author

Commented:
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
CERTIFIED EXPERT
Top Expert 2008

Commented:
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...

Author

Commented:
Does anyone know how to do that?

Author

Commented:
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?
Commented:
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.

OR

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.