zoukankan      html  css  js  c++  java
  • 无法找到System.Runtime.Serialization.Json的奇怪问题

    昨天在开发时遇到一个很简单但是很奇怪的问题 

    if ((filterContext.HttpContext.Request.ContentType ?? string.Empty).Contains("application/json"))
    {
        object o =new DataContractJsonSerializer(RootType).ReadObject(filterContext.HttpContext.Request.InputStream);
        filterContext.ActionParameters[Param] = o;
    }

    DataContractJsonSerializer 无法找到相应的链接库, 添加了System.Runtime.Serialization也无法解决。

    解决问题的思路是:

    1.认为是自己没有.net 3.0的版本,检查了之后发现存在,然后想到可能不是最新的版本,于是上网下载更新,结果依然没有解决问题。

    2.google it and find the answer:

    You need to add a reference to the System.ServiceModel assembly as well.

    using System.Runtime.Serialization;
    using System.ServiceModel;

    System.Runtime.Serialization.dll(下载
    System.ServiceModel.dll
    System.ServiceModel.Web.dll

    Hope this helps!

    Very Stranger but very happy
  • 相关阅读:
    Scala与Mongodb实践1-----mongodbCRUD
    Scala实践14
    Scala实践13
    Scala实践12
    Scala实践11
    Scala实践10
    Scala实践9
    Scala实践6
    Scala实践8
    Oracle Object Type
  • 原文地址:https://www.cnblogs.com/hongfei/p/2869259.html
Copyright © 2011-2022 走看看