我正嘗試爲自託管創建第二個應用程序主機,因此我的單元測試與服務位於同一進程中,以幫助調試。我創建了新的應用程序主機,如下所示。當我的單元測試調用的.init()方法時,收到以下錯誤:嘗試實施AppHostHttpListenerBase的許可證錯誤
ServiceStack.LicenseException是由用戶代碼未處理 的HResult = -2146233088 消息= '10上操作ServiceStack的自由配額限制具有已達到。請參閱https://servicestack.net以升級到商業許可證或訪問https://github.com/ServiceStackV3/ServiceStackV3以恢復到免費的ServiceStack v3。 Source = ServiceStack.Text
下面的類與我的真正的AppHost(我的主要ASP.NET服務項目)在同一個程序集中,所以在web.config中肯定有一個許可證密鑰。文件。
public class ServiceTestAppHost : AppSelfHostBase
{
public const string BaseUrl = "http://localhost/dvsvc";
public ServiceTestAppHost()
: base("Test Web Services", typeof(DV.Svc.Interface.HelloService).Assembly) { }
public override void Configure(Funq.Container container)
{
ServiceStack.Text.JsConfig.IncludeNullValues = true;
ServiceStack.Text.JsConfig.DateHandler = ServiceStack.Text.DateHandler.ISO8601;
ServiceStack.Text.JsConfig.ExcludeTypeInfo = true; //exclude the type specification
ServiceStack.Formats.HtmlFormat.Humanize = false;
//most apps use credentials auth. the TVTI player uses Basic auth
Plugins.Add(new AuthFeature(() =>
new DVAuthUserSession(),
new ServiceStack.Auth.IAuthProvider[] { new DVCredentialsAuthProvider(), new DVBasicAuthProvider() })
/*{ HtmlRedirect = null }*/
);
//in memory cache
container.RegisterAs<MemoryCacheClient, ICacheClient>();
SetConfig(new HostConfig { DebugMode = true });
}
}