小编obi*_*ues的帖子

获得HttpStatusCode为0

如果我将客户端连接的服务指向错误的URL,为什么我得到的HttpStatusCode为0.

我的statusCodeAsInt显示为0.为什么它没有显示为404并正在处理?

IRestResponse response = client.Execute(restReq);
HttpStatusCode statusCode = response.StatusCode;

var statusCodeAsInt = (int) statusCode;

        if (statusCodeAsInt >= 500)
        {
            throw new InvalidOperationException("A server error occurred: " + response.ErrorMessage, response.ErrorException);
        }
        if (statusCodeAsInt >= 400)
        {
            throw new InvalidOperationException("Request could not be understood by the server: " + response.ErrorMessage,
                response.ErrorException);
        }
Run Code Online (Sandbox Code Playgroud)

处理此RestResponse的正确方法是什么?

c# rest http http-status-codes http-status-code-404

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

在Visual Studio 2017中使用Windows Silverlight进行开发的解决方案?

我们公司正试图一起删除Visual Studio 2015,但我们仍然有一些Silverlight代码.

有没有一种解决方法能够在VS 2017中使用Silverlight,即使它不受支持,或者更轻量级的解决方案,而不是既要保留IDE,要么只使用2015?

.net silverlight visual-studio visual-studio-2015 visual-studio-2017

12
推荐指数
3
解决办法
5426
查看次数

如何将Google表格连接到数据库

我正在尝试使用查询在我的Google工作表文件中的工作表上自动填充一些原始数据.

它似乎没有像Microsoft Excel那样具有任何内置功能.

我错过了什么吗?我发现一个附加组件已经停止使用,不再适用于所有地方的数据:https://www.dataeverywhere.com/use-database-sheets

还有其他东西已经取代了吗?

google-sheets google-sheets-api

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

停止Chrome Tab睡眠/休眠

如何阻止Chrome的标签为Sleep/Hibernate?我正在运行"左轮手枪"扩展,我希望在我循环之前重新加载标签..但是看起来Chrome的标签处于休眠状态,所以它不会重新加载,直到标签处于"活动"状态展示.

这有解决方法吗?

tabs google-chrome google-chrome-extension page-refresh

6
推荐指数
2
解决办法
5226
查看次数