Service Stack Hello World: EndpointHost.Config exception is null

I follow the "Hello World" tutorial from http://www.servicestack.net/ServiceStack.Hello/ . But when I try to run the asp.net application, it says: "The value cannot be empty. Parameter name: EndpointHost.Config."

Full text of exception:

[ArgumentNullException: Der Wert darf nicht NULL sein. Parametername: EndpointHost.Config] [ConfigurationErrorsException: ServiceStack: AppHost does not exist or has not been initialized. Make sure you have created an AppHost and started it with 'new AppHost().Init();' in your Global.asax Application_Start()] ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory..cctor() in C:\src\ServiceStack\src\ServiceStack\WebHost.EndPoints\ServiceStackHttpHandlerFactory.cs:45 [TypeInitializationException: Der Typeninitialisierer fΓΌr "ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory" hat eine Ausnahme verursacht.] [TargetInvocationException: Ein Aufrufziel hat einen Ausnahmefehler verursacht.] System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck) +0 System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache) +86 System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache) +230 System.Activator.CreateInstance(Type type, Boolean nonPublic) +67 System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +1051 System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +111 System.Web.Configuration.HttpHandlerAction.Create() +57 System.Web.Configuration.HandlerFactoryCache..ctor(HttpHandlerAction mapping) +19 System.Web.HttpApplication.GetFactory(HttpHandlerAction mapping) +96 System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) +125 System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +93 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155 

My global class:

 public class Global : System.Web.HttpApplication { /// Web Service Singleton AppHost public class InfoAppHost : AppHostBase { //Tell Service Stack the name of your application and where to find your web services public InfoAppHost() : base("Services", typeof(InfoService).Assembly) { } public override void Configure(Funq.Container container) { } } protected void Application_Start(object sender, EventArgs e) { //Initialize your application var appHost = new InfoAppHost(); appHost.Init(); } } 

But he seems to never be called. Compiling a sample project from the home page works great, but I would like to follow the example from the home page. Any ideas how to solve this problem?

+4
source share
5 answers

I deleted my test project and tried the tutorial again.

When creating the Global.asax file, I deleted the entire class and made another Global class in this file. It seems Application_Start has never been called in this class.

+2
source

The problem that you might have guessed is that appHost.Init () is not running. Try wrapping it in try / catch and logging any errors that might have been thrown.

+1
source

We had the same problem and it was solved by setting "Activate 32-bit applications" to true in the advanced settings of ApplicationPool. (sorry, you only have German Windows, so the settings names are rough guesses)

+1
source

Spent me trying to figure out what I'm doing wrong to cause this problem ...

this happened to me because I accidentally dragged the Global.asax file into a subfolder in my project.

0
source

I found that this error was caused by WebApiConfig. The example uses ServiceStack and does not need the ASP.NET Web API. This line should be commented out in the Gloabal.asax.cs file.

  protected void Application_Start() { AreaRegistration.RegisterAllAreas(); // ** comment out ** WebApiConfig.Register(GlobalConfiguration.Configuration); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); new ProteinTrackerAppHost().Init(); } 
0
source

All Articles