2012-02-02 16 views
8

Próbuję postępować zgodnie z przykładem Hello ServiceStack. Używam programu Visual Studio 2010, programu Windows 7 w wersji 64-bitowej, ale usługi IIS są skonfigurowane do uruchamiania aplikacji 32-bitowych. Utworzony przeze mnie projekt Hello wykorzystuje ASP.Net MVC3. Otrzymuję ten błąd podczas próby uzyskania dostępu do metadanych:Błąd ServiceStack Ładowanie WebHost Endpoint

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 
+0

Jak zainstalowałeś ServiceStack przez NuGet? Spróbuj zaktualizować zarówno ServiceStack, jak i WebActivator – mythz

+0

Tak, przez Nuget. – cksanjose

+0

Właśnie wypróbowałem najnowszą wersję NuGet, działa dla mnie. Czy to działa, gdy używasz wewnętrznego WebDevServer? (tzn. w Project Properties/Web/Use VS Dev WebServer) – mythz

Odpowiedz

9

wpadłem na ten sam problem - kiedy stworzył pusty projekt ASP.NET nazwałem go - trafnie wystarczy - ServiceStack. (Problem z aktywacją) Kiedy zaktualizowałem nazwę projektu ASP (i wszystkie odpowiadające mu przestrzenie nazw) do czegoś podobnego do ServiceStackExperiment - wszystko było jednorożcem i tęczą.

16

Jest to bardzo stary post, ale może to pomóc komuś, gdyby otrzymał podobny błąd przy opracowywaniu przeciwko wersji ServiceStack 4.

Było kilka poprawek wymaganych do pliku web.config, jeśli zdecydowałeś się na kopiowanie i wklej z niektórych przewodników servicestack które zostały napisane dla wersji ServiceStack 3.

Http sekcje Wózek który ma nazw ServiceStack.Webhost będą musiały zostać zmienione na coś takiego do

<httpHandlers> 
    <add path="*" type="ServiceStack.HttpHandlerFactory, ServiceStack" verb="*"/> 
    </httpHandlers> 

    <handlers> 
    <add path="*" name="ServiceStack.Factory" type="ServiceStack.HttpHandlerFactory, ServiceStack" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true" />   
    </handlers> 

Mam nadzieję, że to komuś pomaga!

+0

Dzięki, pomogło! – derFunk

Powiązane problemy