Dockerized Asp.net core 2.1 - Hangfire not starting



>情况: 将 Hangfire 与 Asp.net core 2.1 和 Docker 一起使用。

  • 应用在 docker 运行时崩溃。当我评论所有与 杭火,应用程序完美运行。

  • 如果我在Visual Studio上通过IIS express运行该应用程序,则应用程序在Hangfire上运行良好

问题:

Application startup exception: System.Exception: Cannot connect to SQL Server Browser. Ensure SQL Server Browser has been started. ---> System.Net.Internals.SocketExceptionFactory+ExtendedSocketException: No such device or address
\\\\\\\\\\\
\\\\\\\\\\\

at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider provider)
at Hangfire.HangfireApplicationBuilderExtensions.ThrowIfNotConfigured(IApplicationBuilder app)
at Hangfire.HangfireApplicationBuilderExtensions.UseHangfireServer(IApplicationBuilder app, BackgroundJobServerOptions options, IEnumerable`1 additionalProcesses, JobStorage storage)

码头工人运行时出错

appsettings.json 上的连接字符串:

"ConnectionStrings": {
"TestDB": "Server=[server_instance]\LOCALHOST;database=[db1];uid=[user];pwd=[pwd]",
"HangfireDB": "Server=[server_instance]\LOCALHOST;database=Hangfire;uid=[user];pwd=[pwd]"
},

知道为什么会这样吗? 谢谢

将连接字符串中的服务器值从 LOCALHOST 更改为您的 IP

最新更新