This is driving me nuts, maybe I'm missing something but I'm trying to upgrade a .NET 3.5 application to .NET 4.0 and the only problem I'm running into is this class:
3.5 Code:
public class ServiceHostFactory : System.ServiceModel.Activation.ServiceHostFactory { protected override System.ServiceModel.ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses) { return new ServiceHost(serviceType, baseAddresses); } }
When I upgrade to 4.0, it appears that "ServiceHostFactory" doesn't exist (it is red). Going into Object Browser, under System.ServiceModel.Activation, it indeed shows no ServiceHostFactory.
According to this:
http://msdn.microsoft.com/en-us/library/system.servicemodel.activation.servicehostfactory.aspx
It should be supported in 4.0. What am I missing here?
The System.ServiceModel.dll has some items in the System.ServiceModel.Activation namespace.
However, ServiceHostFactory is in the System.ServiceModel.Activation.dll itself. So you need to add a reference to that assembly. Keep in mind that by default, VS2010 appears to want to use the .NET 4 Client Profile, so you'll need to change that to the regular .NET 4 profile before you can add the reference to System.ServiceModel.Activation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With