2013-01-16 63 views
2

我是mono/linux的新手,我尝试使用mod_mono在ubuntu/apache2上托管我现有的asp.net mvc3网站。一切正常,除了调用ServiceStack服务时,如果反序列化服务的响应(该服务位于不同proc中托管的同一台机器上),似乎会失败。我已经看过单声道gac和组件在那里(正确的版本/关键)。此外,如果我从monodevelop/xsp运行网站,一切正常。任何想法,为什么类型加载失败赞赏。无法加载类型'System.Runtime.Serialization.Json.DataContractJsonSerializer'


    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 Runtime Version: 2.10.8.1 (Debian 2.10.8.1-5ubuntu1); 
    ASP.NET Version: 4.0.30319.1 
    ServiceStack 3.9.32 

回答

4

我有同样的问题。发生这种情况的原因是ServiceStack库在运行时无法找到3.5版本的System.ServiceModel.Web。我将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/ 
相关问题