我在web.config中获得了一个“错误的模块指定”红色波浪形,用于以下行:
<add path="*" name="ServiceStack.Factory" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack, Version=3.9.38.0, Culture=neutral, PublicKeyToken=null" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true" />
<add path="*" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack, Version=3.9.38.0, Culture=neutral, PublicKeyToken=null" verb="*"/>
仅供参考,我确保不会按照类似帖子的建议选择.NET框架版本3.5的客户端配置文件。
当我选择Resharper提供的“修复模块资格”时,我仍然在web.config中收到错误指示。
我正在关注ServiceStack网站提供的示例应用程序。我安装了ServiceStack的最新稳定版本,这是我的package.config:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ServiceStack" version="3.9.38" targetFramework="net35" />
<package id="ServiceStack.Common" version="3.9.38" targetFramework="net35" />
<package id="ServiceStack.OrmLite.SqlServer" version="3.9.39" targetFramework="net35" />
<package id="ServiceStack.Redis" version="3.9.38" targetFramework="net35" />
<package id="ServiceStack.Text" version="3.9.38" targetFramework="net35" />
</packages>
当我运行该应用程序时,我会收到这条友好的消息:
配置错误
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Could not load type 'ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory' from assembly 'ServiceStack, Version=3.9.38.0, Culture=neutral, PublicKeyToken=null'.
答案 0 :(得分:3)
搜索&#34;找不到ServiceStackHttpHandlerFactory。&#34;在我的例子中,Pluralsight和其他地方使用的示例是添加ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory
的默认处理程序,用于ServiceStack 3.9。升级到ServiceStack 4.5.0,工厂为ServiceStack.HttpHandlerFactory
。 e.g:
<add path="*" name="ServiceStack.Factory" type="ServiceStack.HttpHandlerFactory, ServiceStack" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true" />
答案 1 :(得分:1)
ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory
类型位于主 ServiceStack.dll 内。如果它找不到它而没有被正确引用,这可能是由于尝试将其添加到错误的配置文件(例如客户端配置文件),或者在您的Web.config所在的主机项目中没有正确引用它。