1

我在我的 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'.
4

2 回答 2

3

这出现在搜索“找不到 ServiceStackHttpHandlerFactory”时。在我的例子中,Pluralsight 和其他地方使用的示例是添加默认处理程序ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory,它是用于 ServiceStack 3.9 的。升级到ServiceStack 4.5.0,出厂为ServiceStack.HttpHandlerFactory. 例如:

<add path="*" name="ServiceStack.Factory" type="ServiceStack.HttpHandlerFactory, ServiceStack" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true" />
于 2016-09-21T21:07:32.267 回答
1

ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory类型位于主ServiceStack.dll中。如果找不到它,则它没有被正确引用,这可能是由于尝试将其添加到错误的配置文件(例如客户端配置文件),或者在您的 Web.config 所在的主机项目中没有正确引用它。

于 2013-03-08T18:49:22.917 回答