c# – ServiceStack Json反序列化错误
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了c# – ServiceStack Json反序列化错误,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1324字,纯文字阅读大概需要2分钟。
内容图文
![c# – ServiceStack Json反序列化错误](/upload/InfoBanner/zyjiaocheng/797/ca131b44d2e2478aaa86524c83155b69.jpg)
这是我的.net核心2.0控制台应用程序的代码:
using ServiceStack;
using System;
using System.Collections.Generic;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
var response = $"http://capfeed.com/json"
.GetJsonFromUrl(httpReq => httpReq.UserAgent = "Hoho")
.FromJson<CapFeedResponse>();
Console.ReadKey();
}
}
public class CapFeedResponse
{
public string success { get; set; }
public string message { get; set; }
public List<CapFeedResponseItem> result { get; set; }
}
public class CapFeedResponseItem
{
public int position { get; set; }
public string symbol { get; set; }
public string name { get; set; }
public long time { get; set; }
public decimal usdPrice { get; set; }
public decimal btcPrice { get; set; }
public long usdVolume { get; set; }
public long mktcap { get; set; }
public long supply { get; set; }
public float change24 { get; set; }
}
}
当我运行应用程序时,我得到以下异常:
System.TypeInitializationException: ‘The type initializer for
‘ServiceStack.Text.JsonSerializer’ threw an exception.’FileNotFoundException: Could not load file or assembly
‘System.Configuration.ConfigurationManager, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51’. The system cannot
find the file specified.
我怎样才能解决这个问题?
解决方法:
当您应该引用ServiceStack.Text.Core时,您可能使用了错误的ServiceStack.Text NuGet包.
内容总结
以上是互联网集市为您收集整理的c# – ServiceStack Json反序列化错误全部内容,希望文章能够帮你解决c# – ServiceStack Json反序列化错误所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。