Web Service fails when referencing it in another site in IIS

I've got a C# 3.5 web service that works fine when its accessed at http://domain/foo/bar/WS.asmx

The /foo/bar part could change in the future so I want to give people a more stable URL that I could update without requiring any changes from them. I created a site in IIS and set it's Home Directory to where WS.asmx is. Now when I try to access it from http://domain2/WS.asmx, I get:

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Could not create type 'Namespace.WS'.

Source Error: Line 1: <%@ WebService Language="C#" CodeBehind="WS.asmx.cs" Class="Namespace.WS" %>

The assemblies in both cases are at http://domain/bin but when I come from domain2 it doesn't seem to know where to find the \bin that is 3 folders up in the file system.

The namespace/classes are more descriptive than that, I just made them basic for the purposes of this question.

13.10.2009 18:50:39
1 ОТВЕТ
РЕШЕНИЕ

Sorry, AFAIK you can't pull DLLs from explicit file paths outside the root of your website. You generally have two choices: 1) use the /bin directory of the current app (make a copy of the other app's /bin) 2) put the DLL into the Global Assembly Cache (GAC)

BTW, this has been asked in a few other spots on SO, like here.

One thing you could do, if your /bin DLLs are only used inside /foo/bar/, is to convert into an IIS application, and then move the DLLs into a new /foo/bar/bin directory. Then you'd only have one copy of the DLL's to manage.

1
23.05.2017 11:48:41
I'll have to go with the bin copying. I also need to reference the web.config from the root of the main site so I might as well just copy it all anyway.
AndyMcKenna 13.10.2009 20:01:37