Skip to content

[dotnet-sdk-10.0.100-preview.7.25351.101] MVCBlog failed to register the account with error "SocketException: No such host is known" #117444

@Junjun-zhao

Description

@Junjun-zhao

Description

When running the 3rd party applications with dotnet-sdk-preview.7.25351.101, MVCBlog app register account failed with error "SocketException: No such host is known".

Reproduction Steps

App Repro steps:

Make sure the machine has localDB and dotnet-sdk-10.0.100-preview.7.25351.101 installed .

  1. Copy \***\BugRepro_Share\2521054\App\MVCBlog to local machine and change MVCBlog.Web.runtimeconfig as following to run the app with dotnet-sdk-10.0.100-preview.7.25351.101.
    "frameworks": [
          {
            "name": "Microsoft.NETCore.App",
            "version": "10.0.0-preview.7.25351.101"
          },
          {
            "name": "Microsoft.AspNetCore.App",
            "version": "10.0.0-preview.7.25351.101"
          }
        ]
    

2.Open the Command Prompt.
3.Navigate to the project directory by entering: cd <- app folder path ->
4.Set the environment variable to Development: set ASPNETCORE_ENVIRONMENT=Development
5.Run the application: dotnet MVCBlog.Web.dll
6.Open http://localhost:5000 with Edge.
7.Click “Register” Button.
(The value in step8~step12 can be set freely)
8.Frist name Input “test”.
9.Last name Input “test.”
10.Input “[email protected]” In the Email.
11.Input “” in the “Password”.
12.Input “
” in the “Confirm Password”.
13.Click ”Register” Button.

Expected behavior

Register successfully.

Actual behavior

Show error:

SocketException: No such host is known.
MailKit.Net.SocketUtils.ConnectAsync(string host, int port, IPEndPoint localEndPoint, CancellationToken cancellationToken)
MailKit.Net.SocketUtils.ConnectAsync(string host, int port, IPEndPoint localEndPoint, int timeout, CancellationToken cancellationToken)
MailKit.MailService.ConnectNetworkAsync(string host, int port, CancellationToken cancellationToken)
MailKit.Net.Smtp.SmtpClient.ConnectAsync(string host, int port, SecureSocketOptions options, CancellationToken cancellationToken)
MVCBlog.Business.Email.EmailNotificationService.SendNotificationAsync(Message message) in EmailNotificationService.cs
await client.ConnectAsync(this.mailSettings.MailHost, this.mailSettings.MailPort, this.mailSettings.UseSsl);
MVCBlog.Web.Infrastructure.Mvc.EmailSenderAdapter.SendEmailAsync(string email, string subject, string htmlMessage) in EmailSenderAdapter.cs
await this.notificationService.SendNotificationAsync(message);
MVCBlog.Web.Areas.Identity.Pages.Account.RegisterModel.OnPostAsync(string returnUrl) in Register.cshtml.cs
await _emailSender.SendEmailAsync(Input.Email, "Confirm your email",
Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.ExecutorFactory+GenericTaskHandlerMethod.Convert<T>(object taskAsObject)
Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.ExecutorFactory+GenericTaskHandlerMethod.Execute(object receiver, object[] arguments)
Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeHandlerMethodAsync()
Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeNextPageFilterAsync()
Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.Rethrow(PageHandlerExecutedContext context)
Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeInnerFilterAsync()
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object state, bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object state, bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)
MVCBlog.Web.Infrastructure.Mvc.SecurityHeaders.SecurityHeadersMiddleware.Invoke(HttpContext context) in SecurityHeadersMiddleware.cs
await this.next(context);
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)

Image

Regression?

Yes

Verify Scenarios:

  1. Windows 11 24H2 x64 + dotnet-sdk-9.0.104: Pass
  2. Windows 11 24H2 x64 + dotnet-sdk-10.0.100-preview.6.25326.107: Pass
  3. Windows 11 24H2 x64 + dotnet-sdk-10.0.100-preview.7.25351.101: Fail

Known Workarounds

No response

Configuration

Application Name: MVCBlog
OS: Windows 11 21H2
CPU: X64
.NET Build Number: 10.0.100-preview.7.25351.101
Shared App & App Source Location checking at: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2521054
Github Linkhttps://github.com/danielpalme/MVCBlog

Other information

Findings:
We found that the issue is that the value in appsettings.Development.json cannot be obtained correctly in development mode.
In appsettings.json, the value of the parameter "sendMails" is "true".
In appsettings.Development.json, the value of the parameter "sendMails" is "false".
When we debug the app in development mode with the latest version sdk dotnet-sdk-10.0.100-preview.7.25351.101,
the value of the parameter "sendMails" we can obtain is "false" at the beginning, but it will change to "true" after app.run().

@dotnet-actwx-bot @dotnet/compat

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions