【问题标题】:Could not load file or assembly System.Runtime.Serialization after publishing via Windows Azure通过 Windows Azure 发布后无法加载文件或程序集 System.Runtime.Serialization
【发布时间】:2014-07-14 15:31:41
【问题描述】:

我使用 Windows Azure sdk 发布了我的解决方案,现在我收到此错误:

“/”应用程序中的服务器错误。
无法加载文件或程序集“System.Runtime.Serialization,Version=2.0.5.0,Culture=neutral,PublicKeyToken=7cec85d7bea7798e”或其依赖项之一。系统找不到指定的文件。
说明:在执行当前网络请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。

异常详细信息:System.IO.FileNotFoundException:无法加载文件或程序集“System.Runtime.Serialization, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e”或其其中之一依赖关系。系统找不到指定的文件。

来源错误:在执行当前网络请求期间产生了未处理的异常。可以使用下面的异常堆栈跟踪来识别有关异常起源和位置的信息。

程序集加载跟踪:以下信息有助于确定程序集“System.Runtime.Serialization, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e”的原因.

警告:程序集绑定日志记录已关闭。 要启用程序集绑定失败日志记录,请将注册表值 [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) 设置为 1。 注意:有一些与程序集绑定失败日志相关的性能损失。 要关闭此功能,请删除注册表值 [HKLM\Software\Microsoft\Fusion!EnableLog]。

堆栈跟踪:[FileNotFoundException:无法加载文件或程序集“System.Runtime.Serialization,Version=2.0.5.0,Culture=neutral,PublicKeyToken=7cec85d7bea7798e”或其依赖项之一。系统找不到指定的文件。]
System.ModuleHandle.ResolveType(RuntimeModule 模块,Int32 typeToken,IntPtr* typeInstArgs,Int32 typeInstCount,IntPtr* methodInstArgs,Int32 methodInstCount,ObjectHandleOnStack 类型)+0
System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule 模块, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) +371
System.ModuleHandle.ResolveTypeHandle(Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) +19
System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) +319
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 203
System.Reflection.CustomAttribute.IsCustomAttributeDefined(RuntimeModule 装饰模块,Int32 装饰MetadataToken,RuntimeType attributeFilterType,Int32 attributeCtorToken,布尔型 mustBeInheritable)+745
System.Reflection.CustomAttribute.IsDefined(RuntimeType type, RuntimeType caType, Boolean inherit) +300
System.ServiceModel.Description.TypeLoader.CreateMessageDescription(MethodInfo methodInfo, Boolean isAsync, Boolean isTask, Type taskTResult, XmlName returnValueName, String defaultNS, String action, XmlName wrapperName, String wrapperNamespace, MessageDirection direction) +415
System.ServiceModel.Description.TypeLoader.CreateOperationDescription(ContractDescription contractDescription, MethodInfo methodInfo, MessageDirection direction, ContractReflectionInfo反射信息, ContractDescription declaringContract) +1895
System.ServiceModel.Description.TypeLoader.CreateOperationDescriptions(ContractDescription contractDescription,ContractReflectionInfo 反射信息,类型 contractToGetMethodsFrom,ContractDescription declaringContract,MessageDirection 方向)+276
System.ServiceModel.Description.TypeLoader.CreateContractDescription(ServiceContractAttribute contractAttr, Type contractType, Type serviceType, ContractReflectionInfo& reflectInfo, Object serviceImplementation) +1307
System.ServiceModel.Description.TypeLoader.LoadContractDescriptionHelper(Type contractType, Type serviceType, Object serviceImplementation) +289
System.ServiceModel.Description.ContractDescription.GetContract(Type contractType, Type serviceType) +192
System.ServiceModel.ServiceHost.CreateDescription(IDictionary`2& 实施合同) +591
System.ServiceModel.ServiceHostBase.InitializeDescription(UriSchemeKeyedCollection baseAddresses) +166
System.ServiceModel.ServiceHost..ctor(Type serviceType, Uri[] baseAddresses) +474
System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(Type serviceType, Uri[] baseAddresses) +42
System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses) +569
System.ServiceModel.HostingManager.CreateService(String normalizedVirtualPath, EventTraceActivity eventTraceActivity) +1435
System.ServiceModel.HostingManager.ActivateService(ServiceActivationInfo serviceActivationInfo, EventTraceActivity eventTraceActivity) +76
System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity) +901

[ServiceActivationException:服务'/CarManagerApi.svc'由于编译过程中的异常而无法激活。异常消息是:无法加载文件或程序集“System.Runtime.Serialization,Version=2.0.5.0,Culture=neutral,PublicKeyToken=7cec85d7bea7798e”或其依赖项之一。该系统找不到指定的文件..] System.Runtime.AsyncResult.End(IAsyncResult 结果) +622882
System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult 结果) +196075
System.Web.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar) +282

我在代码中找不到错误。 有什么问题?

【问题讨论】:

    标签: c# .net wcf asp.net-mvc-4 azure


    【解决方案1】:

    我的问题是同一解决方案的项目中的不同 .Net 框架

    【讨论】:

      【解决方案2】:

      听起来框架 2.0 没有安装在远程机器上。

      【讨论】:

      • 远程机器在windows azure上
      【解决方案3】:

      我在库中使用 Newtonsoft.Json 时遇到了这个问题。该库在 Windows 上运行良好,但在 OS X 上与 Mono 一起使用时出现此错误。

      为了让它运行,我必须将实际的 System.Runtime.Serialization.dll 复制到应用程序目录中。

      显然这不是一个很好的解决方案,但它确实有效。

      【讨论】:

        猜你喜欢
        • 2018-04-16
        • 2014-09-02
        • 2013-12-17
        • 2018-11-09
        • 2014-10-22
        • 2013-01-29
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多