【发布时间】:2012-02-25 14:11:46
【问题描述】:
我正在尝试遵循 ServiceStack 的 Hello 示例。我使用的是 Visual Studio 2010,Win 7 64 位,但 IIS 配置为运行 32 位应用程序。我创建的 Hello 项目使用的是 ASP.Net MVC3。我在尝试访问元数据时收到此错误:
Could not load type 'ServiceStack.WebHost.Endpoints.AppHostBase' from assembly 'ServiceStack, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.TypeLoadException: Could not load type 'ServiceStack.WebHost.Endpoints.AppHostBase' from assembly 'ServiceStack, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[TypeLoadException: Could not load type 'ServiceStack.WebHost.Endpoints.AppHostBase' from assembly 'ServiceStack, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.]
System.Reflection.CustomAttribute._CreateCaObject(RuntimeModule pModule, IRuntimeMethodInfo pCtor, Byte** ppBlob, Byte* pEndBlob, Int32* pcNamedArgs) +0
System.Reflection.CustomAttribute.CreateCaObject(RuntimeModule module, IRuntimeMethodInfo ctor, IntPtr& blob, IntPtr blobEnd, Int32& namedArgs) +46
System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent) +529
System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType) +103
System.Reflection.RuntimeAssembly.GetCustomAttributes(Type attributeType, Boolean inherit) +64
WebActivator.AssemblyExtensions.GetActivationAttributes(Assembly assembly) +145
WebActivator.ActivationManager.RunActivationMethods() +216
WebActivator.ActivationManager.RunPreStartMethods() +43
WebActivator.ActivationManager.Run() +69
[InvalidOperationException: The pre-application start initialization method Run on type WebActivator.ActivationManager threw an exception with the following error message: Could not load type 'ServiceStack.WebHost.Endpoints.AppHostBase' from assembly 'ServiceStack, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'..]
System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +423
System.Web.Compilation.BuildManager.CallPreStartInitMethods() +306
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +677
[HttpException (0x80004005): The pre-application start initialization method Run on type WebActivator.ActivationManager threw an exception with the following error message: Could not load type 'ServiceStack.WebHost.Endpoints.AppHostBase' from assembly 'ServiceStack, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'..]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9089964
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +97
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +258
【问题讨论】:
-
您是如何通过 NuGet 安装 ServiceStack 的?尝试同时更新 ServiceStack 和 WebActivator
-
刚刚在 NuGet 上试用了最新版本,对我有用。当您使用内部 WebDevServer 时它是否有效? (即在 Project Properties/Web/Use VS Dev WebServer 中)
-
已经设置为使用 VS 开发服务器。我认为这是 web.config 文件。有一条消息指出找不到位置元素“ServiceStack”。谢谢你的帮助!!
-
注意:如果您通过 NuGet 安装它,则 location 元素上的自定义路径应该是“api”而不是“servicestack”。您是否尝试过手动安装以及通过 NuGet 安装?我会删除所有内容并重新开始。
标签: visual-studio-2010 windows-7 64-bit servicestack