gpt4 book ai didi

aws-lambda - 使用 C# AWS Lambda 函数连接到 SQL Server Express 时遇到问题

转载 作者:行者123 更新时间:2023-12-02 06:29:31 31 4
gpt4 key购买 nike

尝试使用 System.Data.SqlClient 通过 AWS Lambda 连接到 SQL Server Express RDS 实例时,出现以下错误:

"errorType": "PlatformNotSupportedException",
"errorMessage": "Operation is not supported on this platform.",
"stackTrace": [
"at System.Runtime.InteropServices.OSPlatform.get_Windows()",
"at System.Data.SqlClient.SNI.SNITCPHandle.d__22.MoveNext()"
]

我使用 Amazon.Lambda.Tools 构建部署包。运行该函数并从本地连接到数据库工作正常,但在尝试在 AWS Lambda 上运行时失败。

这是我的project.json:

{
"version": "1.0.0-*",
"description": "AWS lambda Console Application",
"authors": [ "" ],
"packOptions": {
"tags": [],
"projectUrl": "",
"licenseUrl": ""
},
"buildOptions": {
"emitEntryPoint": true
},
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0"
},
"Newtonsoft.Json": "9.0.1",
"Amazon.Lambda.Core": "1.0.0*",
"Amazon.Lambda.Serialization.Json": "1.0.1",
"Amazon.Lambda.Tools": {
"type": "build",
"version": "1.0.0-preview1"
},
"Dapper": "1.50.2",
"System.Data.SqlClient": "4.3.0"
},
"tools": {
"Amazon.Lambda.Tools": "1.0.0-preview1"
},
"commands": {
"AwsLambda": "run"
},
"frameworks": {
"netcoreapp1.0": {
"imports": "dnxcore50"
}
}
}

最佳答案

有同样的问题,对我来说只是改变

"System.Data.SqlClient": "4.3.0"

"System.Data.SqlClient": "4.1.0"

为我工作。我不必更改 NetCore.App 依赖项。

关于aws-lambda - 使用 C# AWS Lambda 函数连接到 SQL Server Express 时遇到问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41613781/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com