BaseLine:ServiceStack示例适用于股票MVC 4应用程序。我正在使用该变体,遵循自述文件中的所有说明,没有问题。
插件框架 我正在为MVC构建一个插件框架,而servicestack.net是其中一个插件,即所有程序集都是使用BuildManager.AddReferencedAssembly(assembly)加载的插件; BuildManager.AddCompilationDependency(assembly.FullName);
从我的个人shawdowFolder中找到并成功加载了所有ServiceStack dll。
webconfig:
<location path="api">
<system.web>
<httpHandlers>
<add path="*" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory,ServiceStack" verb="*" />
</httpHandlers>
</system.web>
<!-- Required for IIS 7.0 -->
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<add path="*" name="ServiceStack.Factory" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory,ServiceStack" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true" />
</handlers>
</system.webServer>
</location>
* 注意:我正在从Application_Start AppHost.Init()调用,我可以执行它,以便在ASP.NET应用程序全面展开之前真正加载和使用ServiceStack。*
首次启动时:/ api / metadata结果为:
2>'/'应用程序中的服务器错误。无法找到资源。 说明:HTTP 404.您要查找的资源(或其中一个依赖项)可能已被删除,名称已更改或暂时不可用。请查看以下网址,确保拼写正确。
请求的网址:/ api / metadata
停止调试器并简单地重新启动,从我的个人shawdowFolder中删除所有程序集,复制它们,加载它们,引用它们,结果。
正在运作的ServiceStack.net
StarterTemplate ASP.NET主机
支持以下操作。有关正式定义,请查看服务XSD。 等
我怀疑这个问题与.NET的shadowfolder和appdomain有关,但也许它与ServiceStack有关。我在哪里可以找到日志,看看ServiceStacks httphanderfactory是否有问题。
答案 0 :(得分:2)
我更改了我的配置如下:
SetConfig(new EndpointHostConfig
{ ServiceStackHandlerFactoryPath = "ss"}
和我的配置:
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add type="DevExpress.Web.ASPxClasses.ASPxHttpHandlerModule, DevExpress.Web.v13.1, Version=13.1.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" name="ASPxHttpHandlerModule" />
<add name="FormsAuthenticationDisposition" type="ServiceStack.ServiceInterface.SuppressFormsAuthenticationRedirectModule, ServiceStack.ServiceInterface" />
</modules>
<handlers>
<add type="DevExpress.Web.ASPxUploadControl.ASPxUploadProgressHttpHandler, DevExpress.Web.v13.1, Version=13.1.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" verb="GET,POST" path="ASPxUploadProgressHandlerPage.ashx" name="ASPxUploadProgressHandler" preCondition="integratedMode" />
<add type="DevExpress.Web.ASPxClasses.ASPxHttpHandlerModule, DevExpress.Web.v13.1, Version=13.1.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" verb="GET" path="DX.ashx" name="ASPxHttpHandlerModule" preCondition="integratedMode" />
<add path="ss*" name="ServiceStack.Factory" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true" /></handlers>
<validation validateIntegratedModeConfiguration="false" />
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="30000000" />
</requestFiltering>
</security>
</system.webServer>
现在我必须输入以下内容才能访问我的服务栈区域:http://localhost/ss/
我对错误的看法是mvc / asp.net forms / servicestack每个都需要一个入口点来将其处理程序映射到url路由,servicestack会覆盖你的MVC项目的“/”url路由,因此没有资源找到了。
因此,在我的申请中,我曾经分开参赛作品:
*http://localhost/*
....是我正常的webforms入口点(在你的情况下是MVC4 [stock])
http://localhost/ss
....是我的服务栈入口点
如果您使用的是MVC剃须刀引擎,则不会遇到此问题。