tags:

views:

581

answers:

1

Hi all.

I've found a lot of similar looking issues, but nothing that has made it clear to me why I am getting an error I'm getting.

Using all sorts of WCF projects, if I try to host them in IIS I get the following error:

The type 'Microsoft.ServiceModel.Samples.CalculatorService', provided as the Service attribute value in the ServiceHost directive could not be found.

This is the exact error I get when I follow the instructions on http://msdn.microsoft.com/en-us/library/ms733766.aspx.

I have this same error (with a different class name) for all the other WCF projects I've tried to host in my local IIS, and on IIS on a 2008 server, including ones that go with Essential WCF 3.5 and a service I've created from scratch.

I'm not sure what needs to match with what, or if I'm missing something on my svc file. Copying the MS example though I have just the single line in my svc file:

<%@ServiceHost language=c# Debug="true" Service="Microsoft.ServiceModel.Samples.CalculatorService"%>

My own service is working, it seems, when I run it just pressing F5 in VS2008 then access it using WCF Test Client. If I try to add service and pass in http://localhost/IISHostedCalc/Service.svc I get:

Error: Cannot obtain Metadata from http://localhost/IISHostedCalc/Service.svc If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address.

Can anyone help? All the examples I've seen seem to suggest this should just work, so I may no idea what I need to do. I'd guess it's a setting thing, but I have no idea what the "thing" is!

A: 

See this post, might duplicate / same issue with you http://stackoverflow.com/questions/1222213/wcf-iis-6-vs-iis-7

Jirapong
Hmm, it's close, but I am trying to do a different thing. My code won't run on IIS7 on my local box, with pretty much access full open. The message I've got isn't as "far" in the chain of error message, from what I can gather reading around.
Retne
How is your web.config looks like?
Jirapong
<?xml version="1.0"?><configuration> <system.serviceModel> <behaviors> <serviceBehaviors> <behavior name="NewBehavior"> <serviceMetadata httpGetEnabled="true" /> </behavior> </serviceBehaviors> </behaviors> <services> <service name="EffectiveWCF.StockService" behaviorConfiguration="NewBehavior" > <endpoint address="" binding="basicHttpBinding" contract="EffectiveWCF.IStockService" /> <endpoint address="mex" binding="mexHttpBinding" contract="EffectiveWCF.IStockService"/> </service> </services> </system.serviceModel></configuration>
Retne
(urgh, that didn't copy well, sorry!)
Retne
There are two points; 1. at mexHttpBinding contract should use "IMetadataExchange"2. I cannot see anything wrong with your sample, but why don't you try this in your VS2008, Create New Project -> Web -> WCF Service Application , at this point, Create another project then add a Service Reference to wcf url
Jirapong