小编ang*_*ogo的帖子

HttpClient在使用语句中

嗨,我读到这篇文章你正在使用HttpClient错误,它正在破坏你的软件,文章建议这些2

  1. 使您的HttpClient静态
  2. 除非您明确要查找特定行为(例如导致服务失败),否则不要将HttpClient丢弃或包装在使用中

现在像我这样的c#上的新手就会跟着它,就像这篇文章上发布的代码是原始代码,他说会使应用程序失败

using System;
using System.Net.Http;
namespace ConsoleApplication
{
    public class Program
    {
        public static void Main(string[] args)
        {
            Console.WriteLine("Starting connections");
            for(int i = 0; i<10; i++)
            {
                using(var client = new HttpClient())
                {
                    var result = client.GetAsync("http://aspnetmonsters.com").Result;
                    Console.WriteLine(result.StatusCode);
                }
            }
            Console.WriteLine("Connections done");
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

并修复它,他给了这个代码:

using System;
using System.Net.Http;
namespace ConsoleApplication
{
    public class Program
    {
        private static HttpClient Client = new HttpClient();
        public static void Main(string[] args)
        {
            Console.WriteLine("Starting connections");
            for(int i = …
Run Code Online (Sandbox Code Playgroud)

c# httpclient

19
推荐指数
2
解决办法
3万
查看次数

visual studio 2013安装microsoft.net framework 4.51时出错

嗨伙计们,我在安装vs 2013时遇到问题,下面的图片显示错误

安装错误

我在Google上研究了很多,我发现在Windows 8.1上.net框架4.5.1已经是操作系统的一部分,当时vs 2013试图安装.net framework 4.5.1然后错误显示.

以下是安装日志

[10B0:0ED0][2014-01-17T10:28:09]e000: Error 0x800713ec: Process returned error: 0x13ec
[10B0:0ED0][2014-01-17T10:28:09]e000: Error 0x800713ec: Failed to execute EXE package.
[1438:1C98][2014-01-17T10:28:09]e000: Error 0x800713ec: Failed to configure per-machine EXE package.
[1438:1C98][2014-01-17T10:28:09]i000: MUX:  Installation size in bytes for package: netfxfullredist_43 MaxAppDrive: 0  MaxSysDrive: 537088000  AppDrive: 0  SysDrive: 17207296
[1438:1C98][2014-01-17T10:28:09]i000: MUX:  Return Code:0x800713EC Msi Messages:0 Result Detail:0 Restart:None
[1438:1C98][2014-01-17T10:28:09]i000: MUX:  Set Result: Return Code=-2147019796 (0x800713EC), Error Message=, Result Detail=, Vital=True, Package Action=Install, Package Id=netfxfullredist_43
[1438:1C98][2014-01-17T10:28:09]i319: Applied execute package: netfxfullredist_43, result: …
Run Code Online (Sandbox Code Playgroud)

visual-studio-2013

9
推荐指数
1
解决办法
1万
查看次数

标签 统计

c# ×1

httpclient ×1

visual-studio-2013 ×1