views:

425

answers:

2

Hello everyone,

I am using VSTS2008 + C# + .Net 3.5 to develop a WCF service hosted in IIS 7.0/6.0. I am learning from the following MSDN link,

http://msdn.microsoft.com/en-us/library/ms733766.aspx

My question is, suppose I implement the WCF service inside a class library and compiled into some specific DLL assembly. In the service svc file, seems there is no way to specify the assembly, in the MSDN sample, only full (including namespace) class name is specified. So, how did WCF runtime finds the assembly which contains the actual implementation of the DLL assembly at server side? Even if I put the assembly into bin sub-folder of the virtual directory, and if there are many DLLs in bin sub-directory, how did WCF runtime knows which dll contains the actual implementation for the specific WCF service?

thanks in avdance, George

+1  A: 

(not working - I've left this here simply for visibility so other SO users can see what didn't work)

I'd need to check, but I'm fairly certain it follows the usual pattern - so you could also have written "Some.Namespace.Service, Some.Assembly.dll" (or if that fails, try it omitting the .dll from the end).

I seem to recall that there is one minor change to normal here... usually the runtime will respect [assembly:TypeForwardedTo(...)], but I don't think that WCF handles this - but otherwise, standard type/dll strings should work.

Marc Gravell
Marc, I find adding dll name does not work. Here is my service.svc file, <%@ ServiceHost Language="C#" Service="Foo.WCF.StudentManagement, WCFDemoClassv1.dll" %>, and I put WCFDemoClassv1.dll into bin sub-directory of the web site. I did not use TypeForwardedTo. Any ideas what is wrong?
George2
Try: "Foo.WCF.StudentManagement, WCFDemoClassv1"
Marc Gravell
Still not working, I have found more information. When click browse in IIS 7.0 to browse service.svc file in browser, the error message is, HTTP Error 404.3 - Not FoundThe page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.
George2
Any hints what is wrong? I have already run ServiceModelReg.exe -i but the same issue. :-(
George2
Hmmm... sorry, I would have expect that to work. Does it work for a simple "hello world" service (i.e. like the standard WCF template)?
Marc Gravell
Hi Marc, I have some new findings, currently I am using IIS 6.0 + Windows Server 2003. I am using anonymous authentication mode, previous the Windows account related to anonymous account is IIS_IUSRS, and now I have changed it to a user in Administrator group, and it works. Any hints why it is a permission issue? And I also tried that if I change application pool account will not work, I have to change the related account for Windows account for anonymous access to IIS 6.0. Thanks.
George2
+2  A: 

Marc is correct about putting the assembly name after the namespace with a comma to separate it: I can confirm that it worked for my own WCF service when I did that. The "dll" extension was not required.

So it sounds like your error 404.3 is due to something other than that. I'm sure I've had that one before, though I'm unable to reproduce it when I try to now. But I have a feeling it had something to do with the permissions on the folder in IIS - perhaps check to see if opening up the permissions more will fix the problem. I think the relevant users would be the IIS_IUSRS on your own machine, and maybe also other processes like NETWORK SERVICE (though I could be wrong on this).

The other thing that springs to mind is encryption; I found that when my web folders were encrypted (with the standard Vista encryption) they couldn't be accessed properly by IIS and would give errors like this. So if you have encryption on those files/folders, maybe try turning it off.

Gavin Schultz-Ohkubo
Any more descriptions about why permission issue will cause this failure?
George2
I have tested when using Administrator group user other than IIS_IUSRS as Windows anonymous authentication account will work. I do not know why it is a permission issue, any ideas why?
George2
I have made further testing and found if I set application pool account, it does not work. I have to set the related Windows account for anonymous authentication. What is the differences between the Windows account related to anonymous authentication and application pool account?
George2
I'm afraid I don't know how permissions really work in IIS - I just suspected permissions were the problem and fiddled with them until they worked. Might be a question for serverfault.com?
Gavin Schultz-Ohkubo
Yes, thanks, I will mark your reply as answered. :-)
George2