博客 (22)

客户端:Failed to connect to host.

服务端:无任何日志

原因:可能是域名、IP 或端口有误,或端口未开放。


客户端/服务端:530 Login incorrect.

原因:用户名或密码错误。


客户端/服务端503 Use AUTH first.

原因:服务端开启了 FTPS 协议(FTP over TLS),且禁止了 FTP 协议(plain FTP)。

解决方法:不建议服务端恢复不安全的 FTP 协议,客户端应配置 client.Config 的 EncryptionMode、DataConnectionEncryption、SslProtocols、ValidateCertificate 等参数。


客户端/服务端:530 This server does not allow plain FTP. You have to use FTP over TLS.

原因:服务端启用了 FTPS。

解决方法:给 client.Config.EncryptionMode 正确的赋值(FtpEncryptionMode.Explicit 或 FtpEncryptionMode.Auto)。


服务端:[Error] TLS session of data connection not resumed.

原因:证书版本有误。

解决方法:给 client.Config.SslProtocols 赋值正确的 TLS 版本。


服务端:521 PROT P required

原因:服务端开启了Require TLS session resumption on data connection when using PROT P”

解决方法:client.Config.DataConnectionEncryption = true;


客户端/服务端450 TLS session of data connection has not resumed or the session does not match the control connection

原因:TLS 与控制连接不匹配,即服务端开启了“Require TLS session resumption on data connection when using PROT P”

解决方法:我暂时还不知道原因,临时关闭了Require TLS session resumption on data connection when using PROT P”(不建议)。该问题出现在 FileZilla Server 0.x 版本,在 1.x 版本中没有该配置选项。

xoyozo 6 个月前
689

在代码

app.Run();

处报错:

System.IO.IOException:“Failed to bind to address http://localhost:5182.”

SocketException: 以一种访问权限不允许的方式做了一个访问套接字的尝试。

原因是端口被占用,解决方法:

方法一、重启电脑可能解决该问题。

方法二、使用命令 netstat -ano 找到占用该端口的进程,关闭即可。

方法三、修改运行端口。展开解决方案资源管理器中项目根目录下的“Properties”目录,打开“launchSettings.json”,找到对应你运行方式的配置,修改相应 Url 中的端口。


xoyozo 1 年前
1,747

[-] .\Navicat-Cracker\NavicatCrackerDlg.cpp:300 ->

    Failed to open libcc.dll

    拒绝访问。  (0x5)


解决方法:以管理员身份运行 exe 文件。

xoyozo 1 年前
6,119

以 ASP.NET 6 返回 BadRequestObjectResult 为例。

public IActionResult Post()
{
    return BadRequest("友好的错误提示语");
}


axios

请求示例:

axios.post(url, {})
.then(function (response) {
    console.log(response.data);
})
.catch(function (error) {
    console.log(error.response.data);
});

error 对象:

{
  "message": "Request failed with status code 400",
  "name": "AxiosError",
  "code": "ERR_BAD_REQUEST",
  "status": 400,
  "response": {
    "data": "友好的错误提示语",
    "status": 400
  }
}


jQuery

请求示例:

$.ajax 对象形式

$.ajax({
    url: url,
    type: 'POST',
    data: {},
    success: function (data) {
        console.log(data)
    },
    error: function (jqXHR) {
        console.log(jqXHR.responseText)
    },
    complete: function () {
    },
});

$.ajax 事件处理形式(Event Handlers)jQuery 3+

$.ajax({
    url: url,
    type: 'POST',
    data: {},
})
    .done(function (data) {
        console.log(data)
    })
    .fail(function (jqXHR) {
        console.log(jqXHR.responseText)
    })
    .always(function () {
    });

$.get / $.post / $.delete

$.post(url, {}, function (data) {
    console.log(data)
})
    .done(function (data) {
        console.log(data)
    })
    .fail(function (jqXHR) {
        console.log(jqXHR.responseText)
    })
    .always(function () {
    });

jqXHR 对象:

{
  "readyState": 4,
  "responseText": "友好的错误提示语",
  "status": 400,
  "statusText": "error"
}


xoyozo 2 年前
1,464

直接运行项目启动程序(在发布目录中,以项目名称为文件名,扩展名为 .exe 的可执行程序)

启动后可在“Now listening on:”所在行看到访问入口 URL(如图中 http://localhost:5000)。

在同服浏览器中打开该地址,访问到报错页面,回到该命令行窗口可见“fail”异常的详细信息。

QQ截图20211003173208.png

xoyozo 3 年前
1,672

今天发现在开发新项目时,微信分享失效了,开启 debug = true 后,在微信开发工具中提示:

{"errMsg":"updateTimelineShareData:fail, the permission value is offline verifying"}

在真机上提示:

{"errMsg":"config:ok"}

{"errMsg":"updateAppMessageShareData:ok"}

{"errMsg":"updateTimelineShareData"}

仍然找不出原因。

尝试打开已上线的项目,分享功能均正常。

偶然发现,当打开使用 JS-SDK 分享后的图文框的页面,能够正常分享,而直接点开链接的页面,没有分享按钮。

这难免不让人联想到最近GJ出的新政,新版微信已经开放淘宝、抖音等平台的链接打开权限,只是当点击链接的时候会出现一个风险提示页面:

d9dd5a9e715606dd77f4b4b47ac44ab.jpg

而一旦由这个页面进入的网页,分享功能均不能正常。

另外还测试了以下几种情况的分享功能也能正常:

公众号推送的图文或链接、公众号菜单、个人发送到公众号的链接、通过扫一扫打开的页面等。

-- 2021.9

xoyozo 3 年前
6,146

当 ASP.NET 发布一个新的小版本更新时(以 .NET 5.0.10 为例),生产环境服务器端可以直接下载安装 .NET 5.0.10 来自动替换 .NET 5.0.9。

倘若这时直接使用 VS 将 nuget 中版本为 5.0.9 的组件更新到 5.0.10 发布到服务器上的话,可能会发生错误:

HTTP Error 500.30 - ASP.NET Core app failed to start

这里我们可以在 nuget 回滚相关组件的版本至 5.0.9,等 VS 发现新的版本更新时,更新 VS 开发工具后,再更新 nuget 组件并进行发布即可。

着急的小伙伴可以直接前往 Microsoft .NET 网站下载安装包含 Runtime 5.0.10 的 SDK:

image.png

该情况同样发生在 ASP.NET Core 3.1 等大版本上。

若仍未生效,请重启服务器

----------------

后注:安装完成后重启服务器可避免以上烦恼!

xoyozo 3 年前
1,463

已使用指定的进程(“Web Management Service”)连接到远程计算机,但未能验证服务器的证书。如果你信任该服务器,请再次连接并允许不信任的证书。  在以下位置了解更多信息: https://go.microsoft.com/fwlink/?LinkId=221672#ERROR_CERTIFICATE_VALIDATION_FAILED。

基础连接已经关闭: 未能为 SSL/TLS 安全通道建立信任关系。

根据验证过程,远程证书无效。


image.pngimage.pngimage.png

xoyozo 3 年前
1,919

fail: Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor[3]

      The view 'Index' was not found. Searched locations: /Areas/AAA/Views/XXX/Index.cshtml, /Areas/AAA/Views/Shared/Index.cshtml, /Views/Shared/Index.cshtml

fail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[1]

      An unhandled exception has occurred while executing the request.

      System.InvalidOperationException: The view 'Index' was not found. The following locations were searched:

      /Areas/AAA/Views/XXX/Index.cshtml

      /Areas/AAA/Views/Shared/Index.cshtml

      /Views/Shared/Index.cshtml


开发环境一切正常,发布到服务器上出现上述错误,找不到视图文件,可视图文件明明就存在。

尝试新建一个文件,将 Index.cshtml 文件的内容拷贝到新文件中保存,删除原文件,将新文件改名为 Index.cshtml,发布,OK。

xoyozo 3 年前
2,597

报错:

HTTP Error 500.30 - ASP.NET Core app failed to start

Common solutions to this issue:

  • The app failed to start

  • The app started but then stopped

  • The app started but threw an exception during startup

Troubleshooting steps:

  • Check the system event log for error messages

  • Enable logging the application process' stdout messages

  • Attach a debugger to the application process and inspect

For more information visit: https://go.microsoft.com/fwlink/?LinkID=2028265


解决:

直接运行网站根目录的 .exe 启动文件可以找到答案。


一个常见的原因是:因 nuget 包升级(特别是需要服务器端安装组件的包)导致的发布后仍然是低版本的包,删除项目中的 /obj/ 目录重新发布即可。

xoyozo 3 年前
6,829