【问题标题】:Could not load type 'System.Runtime.Serialization.Json.DataContractJsonSerializer'无法加载类型“System.Runtime.Serialization.Json.DataContractJsonSerializer”
【发布时间】:2013-01-16 20:56:23
【问题描述】:

我是 mono/linux 的新手,我尝试使用 mod_mono 在 ubuntu/apache2 上托管我现有的 asp.net mvc3 网站。一切正常,除了对 ServiceStack 服务的调用在反序列化来自服务的响应时似乎失败(该服务位于托管在不同 proc 中的同一台机器上)。我查看了mono gac,程序集就在那里(正确的版本/密钥)。此外,如果我从 monodevelop/xsp 运行网站,一切正常。任何关于类型加载失败原因的想法都值得赞赏。


    Could not load type 'System.Runtime.Serialization.Json.DataContractJsonSerializer' from assembly 'System.ServiceModel.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

    Stack Trace:

    System.TypeLoadException: Could not load type 'System.Runtime.Serialization.Json.DataContractJsonSerializer' from assembly 'System.ServiceModel.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
      at ServiceStack.ServiceClient.Web.JsonServiceClient.DeserializeFromStream[List`1] (System.IO.Stream stream) [0x00000] in :0
      at ServiceStack.ServiceClient.Web.ServiceClientBase.HandleResponse[List`1] (System.Net.WebResponse webResponse) [0x00000] in :0
      at ServiceStack.ServiceClient.Web.ServiceClientBase.Send[List`1] (System.String httpMethod, System.String relativeOrAbsoluteUrl, System.Object request) [0x00000] in :0

我正在使用:

Mono 运行时版本:2.10.8.1(Debian 2.10.8.1-5ubuntu1); ASP.NET 版本:4.0.30319.1 服务栈 3.9.32

【问题讨论】:

    标签: asp.net-mvc-3 mono ubuntu-12.04 servicestack apache2.2


    【解决方案1】:

    我遇到了同样的问题。发生这种情况是因为 ServiceStack 库在运行时找不到 System.ServiceModel.Web 的 3.5 版本。我将 3.5 版本从单声道“gac”复制到我的应用程序 bin 目录中,一切都开始正常工作。您的系统/部署中的路径可能不同,但这是我使用的:

    cp /usr/lib/mono/gac/System.ServiceModel.Web/3.5.0.0__31bf3856ad364e35/System.ServiceModel.Web.dll /var/www/path/to/web/app/bin/
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-08-14
      • 2015-08-28
      • 2016-03-05
      • 2014-08-09
      • 2015-04-16
      • 2010-09-08
      • 2017-04-13
      • 2014-01-03
      相关资源
      最近更新 更多