tags:

views:

338

answers:

2

We have a Web project containing both an ASP.Net (forms) UI, and some WCF web services. This is hosted in IIS 6. Both the UI and the WCF services make use of a PDF-generating tool which requires a license, stored in the <appSettings> section of the web.config file. The license is based on the domain of the website, i.e. xxx.com (all subdomains are included in the license).

When the tool's DLL is called, it does some check to see if it is indeed running in a domain for which it's licensed. When the UI calls through to this tool, all works fine. When the WCF services do the same, the tool somehow gets the name of the server rather than the domain, and so thinks it's unlicensed.

I don't really want to concentrate on the tool, what I'd like to know is:

If .aspx and .svc files (and their parent DLL) are both hosted in the same IIS 6 website and virtual directory, should they be running under an identical account / user / permission set / etc? And does it matter that the WCF service implementation (and contracts) are in a separate DLL?

Thanks for any help!

+3  A: 

I wonder how the tool is doing the checking... I expect you might need to enable ASP.NET compatibility mode. The other thing to try is making the address explicit (rather than relative) in the WCF config.

No, it doesn't matter about separate dlls, and it shouldn't matter about accounts (although anything is possible!).

edit:

or in web.config, under system.serviceModel:

 <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
Marc Gravell
+1  A: 

Turning on ASP.Net compatibility does fix the problem. Thanks Marc Gravell! However, it's worth pointing out that you also need to change the class that implements the service contract - the following attribute is required on the class:

[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]

It can also be set to Required. There's a handy table on MSDN.

(I don't know whether the explicit addressing would also work, we can't use it because the service is behind an SSL-offloading load balancer (F5). Therefore WCF thinks the service is over HTTP whereas it's actually over HTTPS.)

Graham Clark