Following a tutorial of using ServiceStack, I'm trying to compile the following code:
public class AppHost : AppHostBase
{
public AppHost() : base("Protein Tracker Web Services", typeof(HelloService).Assembly) { }
public override void Configure(Funq.Container container)
{
SetConfig(new EndpointHostConfig { ServiceStackHandlerFactoryPath = "api" });
}
}
This gives me the following error:
The type or namespace name 'EndpointHostConfig' could not be found (are you missing a using directive or an assembly reference?)
I tried to add the suggested:
using ServiceStack.WebHost.Endpoints;
Gives me the following error:
The type or namespace name 'WebHost' does not exist in the namespace 'ServiceStack' (are you missing an assembly reference?)
You are probably referencing the v4 ServiceStack framework which has just been released into beta. There has been a lot of refactoring and restructuring of the namespaces and classes which is where the conflict will arise.
These release notes for v4 discuss the significant changes made to ServiceStack from v3 to v4.
The part most relevant to you is:
EndpointHostConfig is now HostConfig and is limited to just Configuration.
A lot of the tutorials are still for v3 which is OpenSource, which is what I suspect you are following.
You should include the version number in your nu-get install. Such as:
PM> Install-Package ServiceStack -Version 3.9.71
This will get you the latest OpenSource version of ServiceStack (3.9.71). Or alternatively see the v4 documentation.
v3 Documentation - Relevant for your tutorials
v4 (Latest - commercial)
Hope this helps.
For those may be following outdated tutorials/examples, but wish to use the new v4 API:
The
ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory
used in Web.config's handler mapping has been renamed to justServiceStack.HttpHandlerFactory
This requires a quick update to our service's Web.config:
<handlers>
<add path="*" name="ServiceStack.Factory" type="ServiceStack.HttpHandlerFactory, ServiceStack" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true" />
</handlers>
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