小编m.g*_*iri的帖子

Nuget - 未将对象引用设置为对象的实例

我在vs 2015中遇到了nuget包管理器的问题.像Unity这样的软件包安装没有问题.像EF这样的软件包在安装时遇到了问题.像Automapper这样的软件包有同样的问题,但是当我安装了这个软件包的另一个版本时,安装得很好.

这是输出:

System.NullReferenceException: Object reference not set to an instance of an object.


at NuGet.Protocol.Core.v3.GlobalPackagesFolderUtility.<AddPackageAsync>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at NuGet.Protocol.Core.v3.DownloadResourceV3.<GetDownloadResourceResultAsync>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.PackageManagement.PackageDownloader.<GetDownloadResourceResultAsync>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at …
Run Code Online (Sandbox Code Playgroud)

c# nuget nuget-package visual-studio-2015

1
推荐指数
2
解决办法
7555
查看次数

如何使用HttpClient发送Ajax请求

我有一个网站发送Ajax请求来检查数字的验证.我希望使用HttpClient在我的WPF应用程序中发送该请求.

它使用post方法,这里是请求url:http://sim.mci.ir/chk-number-availability

这是标题:

Accept: */*
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.5
Cache-Control: no-cache
Connection: keep-alive
Content-Length: 18
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Cookie: _ga=GA1.2.589400539.1410935105; JSESSIONID=33719B6BDA36C7C23A96B5E73F602B08; _gat=1
Host: sim.mci.ir
Pragma: no-cache
Referer: http://sim.mci.ir/first-step
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:32.0) Gecko/20100101 Firefox/32.0
X-Requested-With: XMLHttpRequest
Run Code Online (Sandbox Code Playgroud)

这是唯一的价值:

number=09122175567
Run Code Online (Sandbox Code Playgroud)

我以常见方式使用SendAsync()和PostAsync()方法,但它不起作用.我认为问题出在请求标题中.

c# dotnet-httpclient

-1
推荐指数
1
解决办法
8807
查看次数