小编use*_*700的帖子

HttpClient 抛出“发送请求时出错”。

我有三层应用程序架构。

我的客户 --> 我的服务A(在 IIS 中托管的 REST) --> 其他团队的服务X (REST)。

服务 A 是 ASP.Net 4.6.1 框架,而不是 ASP.Net Core。

客户端使用 HttpClient 与 A 通信,A 使用 HttpClient 与 X 通信。

客户向 A 和 X 的服务发出了近 2500 次调用。

2500 次调用服务 A 随机(可能是 10 次调用)失败并出现以下异常。它是不可复制的。

System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> 
System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a 
receive. ---> System.IO.IOException: Unable to read data from the transport connection: An     
established connection was …
Run Code Online (Sandbox Code Playgroud)

c# rest httpclient asp.net-web-api asp.net-web-api2

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

在WinForms中具有复选框的ComboBox

我正在尝试实现一个CheckBox ComboBox。我按照此链接作为参考

http://www.codeproject.com/Articles/31105/A-ComboBox-with-a-CheckedListBox-as-a-Dropdown?msg=4152597#xx4152597xx

但是此示例存在一些问题。

1)显示下拉列表后,单击鼠标第一次更改所选项目的检查状态总会失败,但是可以单击成功。似乎第一次点击就被吞没了。我做了一些跟踪工作,但找不到答案。

2)当列表打开时,表单失去焦点。

c# combobox winforms windows-controls drop-down-menu

5
推荐指数
0
解决办法
3万
查看次数

更新数据库表中的所有列

我想遍历所有表列并替换值为"."的所有列.在sql server中使用null值.所以我在这里写了一些逻辑.但不知何故它不起作用.

create table #AllColumns  
  (  
  ColNo int not null primary key identity(1,1),  
  ColumnName varchar(100)  
  )  
  insert into #AllColumns  
  SELECT  c.name ColumnName  
FROM sys.columns c INNER JOIN
     sys.tables t ON c.object_id = t.object_id INNER JOIN
     sys.schemas s ON t.schema_id = s.schema_id
   where t.name='TabelName'


DECLARE @i int  
DECLARE @numrows int  
DECLARE @columnName varchar(100)  
   set @i=1  
   set @numrows= (SELECT COUNT(*) FROM #AllColumns)  
   IF @numrows > 0  
    WHILE (@i <= (SELECT MAX(ColNo) FROM #AllColumns))  
    BEGIN  
        set @columnName=(select ColumnName from #AllColumns where ColNo=@i)  
        update …
Run Code Online (Sandbox Code Playgroud)

sql t-sql sql-server

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

类中的clss,null引用异常,C#

我的班级看起来像这样.

public class LogSettings
{
    public string attributeName { get; set; }//TODO: change the variable name

    public Warnings[] warnings = new Warnings[3];
}

public class Warnings
{
   public string typeOfWarning {get; set;}

    public bool isAbsolute { get; set; }

    public decimal numUpDownValue { get; set; }

    public LogSettingActions[] actionItems = new LogSettingActions[10];
}

public class LogSettingActions
{
    public string actionItem{ get; set;}
}
Run Code Online (Sandbox Code Playgroud)

但是当我尝试创建Warnings实例时,它会抛出NullReference错误.

var rows = FindChilds<ctlLogConfigRow>(lvLogConfigTemplate);
foreach (var row in rows)
{
    LogSettings instance = new LogSettings();
    instance.attributeName …
Run Code Online (Sandbox Code Playgroud)

c#

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