Does ServiceStack EndpointHostConfig & WebHost not exist? C # MVC

Following the guide to using ServiceStack, I am 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:

Cannot find type name or namespace EndpointHostConfig '(do you miss using directive or assembly reference?)

I tried to add the suggested:

 using ServiceStack.WebHost.Endpoints; 

Gives me the following error:

The WebHost 'namespace type or name does not exist in the "ServiceStack" namespace (do you miss the assembly reference?)

+7
c # visual-studio-2013 servicestack
source share
3 answers

Perhaps you are referring to the v4 ServiceStack framework, which has just been released in beta. There has been a lot of refactoring and restructuring of namespaces and classes in which the conflict occurs.

These release notes for v4 discuss significant changes to the ServiceStack from v3 to v4.

The most important part for you:

EndpointHostConfig is now HostConfig and is limited only by configuration.


Many tutorials are still intended for v3, which is OpenSource, and I suspect you are following it.

You must specify the version number in your nu-get installation. For example:

 PM> Install-Package ServiceStack -Version 3.9.71 

This will give you the latest version of ServiceStack OpenSource (3.9.71). Or, alternatively, see v4 Documentation.

v3 Documentation - Matches your textbooks
v4 (the latter is commercial)

Hope this helps.

+6
source share

There may be legacy tutorials / examples for them, but you want to use the new v4 API:

Used by ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory in the Web.config handler mapping has been renamed to ServiceStack.HttpHandlerFactory

This requires a quick update of our Web.config service:

 <handlers> <add path="*" name="ServiceStack.Factory" type="ServiceStack.HttpHandlerFactory, ServiceStack" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true" /> </handlers> 
+3
source share

I got the same error due to the version in the service stack.
Just change:
EndpointHostConfig HostConfig
ServiceStackHandlerFactoryPath HandlerFactoryPath

Hope this helps.

+2
source share

All Articles