我正在尝试将ServiceStack实现到我的MVC3项目中,并遵循以下教程:
http://www.servicestack.net/ServiceStack.Hello/
我的Global.asax.cs现在看起来像:
public class MvcApplication : System.Web.HttpApplication { public class Hello { public string Name { get; set; } } public class HelloResponse { public string Result { get; set; } } public class HelloService : IService<Hello> { public object Execute(Hello request) { return new HelloResponse { Result = "Hello," + request.Name }; } } public class HelloAppHost : AppHostBase { //Tell Service Stack the name of your application and where to find your web services public HelloAppHost() : base("Hello Web Services",typeof(HelloService).Assembly) { } public override void Configure(Container container) { //register user-defined REST-ful urls Routes .Add<Hello>("/hello") .Add<Hello>("/hello/{Name}"); } } protected void Application_Start() { new HelloAppHost().Init(); } } }
…按照说明.
InvalidDataException: AppHostBase.Instance has already been set
Googling为此提供没有帮助,除了源代码在http://code.google.com/p/servicestack/source/browse/trunk/Common/ServiceStack.Common/ServiceStack.WebHost.Endpoints/AppHostBase.cs?r=1322
看这个,不知何故,实例正在设定.但是怎么样
可能是什么原因造成的?