我们有一个F#assembly(AssemblyOne),它AssemblyTwo在单个Visual Studio 2012解决方案中引用另一个F#assembly(). AssemblyTwo有一个C#DLL(MyCSharpLib)的引用.
调用定义AssemblyOne的函数定义的函数AssemblyTwo:
namespace AssemblyOne
[<RequireQualifiedAccess>]
module MyModuleA =
let FetchResult id =
let result = AssemblyTwo.MyModuleC.FetchResult id
result
Run Code Online (Sandbox Code Playgroud)
AssemblyTwo调用的函数FetchActualResult()在同一个程序集中调用另一个函数(),它接受MyCSharpType属于引用的C#DLL(MyCSharpLib)类型的参数:
namespace AssemblyTwo
[<RequireQualifiedAccess>]
module MyModuleB =
let FetchActualResult(myCSharpType:MyCSharpLib.MyCSharpType, id:int)
//return a result
[<RequireQualifiedAccess>]
module MyModuleC =
let FetchResult id =
let myCSharpType = new MyCSharpLib.MyCSharpType()
MyModuleB.FetchActualResult(myCSharpType, id)
Run Code Online (Sandbox Code Playgroud)
该解决方案在Visual Studio中编译和构建; 但是,当我们尝试使用MSBuild从命令行构建项目时,构建失败,msbuild.log中出现以下错误:
error FS0074: The type referenced through 'MyCSharpLib' is defined in …Run Code Online (Sandbox Code Playgroud) 我们遇到了一个简单的 .NET Core (3.1) 控制台应用程序连接到 SQL Server 数据库并部署在 AWS Fargate (ECS) 上的容器中的问题。SQL Server 是镜像设置(主体/镜像,带有见证以允许自动故障转移)。
当我们(手动)对数据库进行故障转移时会出现问题;观察 SQL Server Profiler,SQL 客户端似乎继续反复尝试连接旧主体(现在是镜像并处于恢复模式)。故障转移后不会尝试连接到新的主体。我们正在使用System.Data.SqlClient.dll作为客户端。记录了以下异常:
System.Exception Cannot connect to SQL Server Browser. Ensure SQL Server Browser has been started.
- at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 …Run Code Online (Sandbox Code Playgroud) 我们有一个简单的 F# 控制台应用程序,它通过FSharp.Data Http.Request. 我们正在使用该customizeHttpRequest参数来尝试设置请求超时属性。我们的用法如下:
let response = Http.Request(
serviceEndpoint,
headers = requestHeaders,
body = requestBody,
silentHttpErrors = true,
customizeHttpRequest = (fun request -> request.Timeout <- 1000; request))
Run Code Online (Sandbox Code Playgroud)
我们观察到我们的自定义超时被忽略(即请求在 1 秒后不会超时,如本例所示)。System.Net.HttpWebRequest我们还观察到,在默认超时 100,000ms后,请求不会超时。
这里有问题吗,还是我们没有customizeHttpRequest正确使用参数?