ServiceStack: Le déploiement provoque Fileloadexception, ne peut pas charger System.Runtime.Sérialisation

StackOverflow https://stackoverflow.com/questions/9473996

  •  13-11-2019
  •  | 
  •  

Question

J'ai un service de servicestack très simple en cours d'exécution, à partir d'un chemin / API / Traduire / .... Cela fonctionne parfaitement localement.Je peux voir XML, Json, etc.

Toutefois, lorsque je déploie le projet dans l'environnement en direct, appelez les résultats du service:

<TranslateResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="">
- <ResponseStatus>
  <ErrorCode>FileLoadException</ErrorCode> 
  <Message>Could not load file or assembly 'System.Runtime.Serialization, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)</Message> 
  <StackTrace>at System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type) at System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) at System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg) at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent) at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeType type, RuntimeType caType, Boolean inherit) at System.RuntimeType.GetCustomAttributes(Type attributeType, Boolean inherit) at ServiceStack.WebHost.EndPoints.Utils.FilterAttributeCache.GetResponseFilterAttributes(Type responseDtoType) in C:\src\ServiceStack\src\ServiceStack\WebHost.EndPoints\Utils\FilterAttributeCache.cs:line 51 at ServiceStack.WebHost.Endpoints.EndpointHost.ApplyResponseFilters(IHttpRequest httpReq, IHttpResponse httpRes, Object responseDto) in C:\src\ServiceStack\src\ServiceStack\WebHost.EndPoints\EndpointHost.cs:line 205 at ServiceStack.WebHost.Endpoints.RestHandler.ProcessRequest(IHttpRequest httpReq, IHttpResponse httpRes, String operationName) in C:\src\ServiceStack\src\ServiceStack\WebHost.EndPoints\RestHandler.cs:line 64</StackTrace> 
  </ResponseStatus>
  </TranslateResponse>

La translateresponse étant mon DTO autrement sainement.Le responsable n'est pas le mien.J'ai vérifié la version .NET ciblant et avoir défini System.Runtime.Séralisation sur "Copier local" et incluse manuellement la DLL dans le dossier / bin.

Mais cela ne fonctionne toujours pas.Où vais-je mal?

Était-ce utile?

La solution

résolu.

C'est l'inclusion d'un projet construit à l'aide du projet de bibliothèque de classe portable.Cette chose semblait trop belle pour être vraie.Ont enlevé (qui résout d'autres problèmes, principalement la mise en œuvre MVVM) et toutes les œuvres.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top