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

Closed

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 “test@163.com” 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 Link:https://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

Activity

  1. added
    untriaged
    on Jul 4, 2025
  2. added
    needs-area-label
    on Jul 4, 2025
  3. removed
    needs-area-label
    on Jul 4, 2025
  4. dotnet-policy-service commented on Jul 4, 2025

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @dotnet/area-extensions-configuration
    See info in area-owners.md if you want to be subscribed.

  5. transferred this issue fromdotnet/runtimeon Jul 6, 2025
  6. tarekgh commented on Jul 6, 2025

    @tarekgh
    Member

    This looks aspnet issue who may need to investigate first.

  7. Junjun-zhao commented on Jul 8, 2025

    @Junjun-zhao
    MemberAuthor

    This issue #117445 is same as this issue, both are caused by the value in appsettings.Development.json cannot be obtained correctly in development mode. Please refer to more details from Findings.

  8. halter73 commented on Jul 8, 2025

    @halter73
    Member

    I can confirm that the IConfiguration indexer (e.g. app.Configuration["MailSettings:SendMails"]) is correctly returning "False", but MailSettings.SendMails gets set true by the ConfigurationBinder. It looks like this was probably a regression introduced by #116677.

    MailSettings:sendMails config shows false from appsettings.Development.json MailSettings.SendMails bound
  9. transferred this issue fromdotnet/aspnetcoreon Jul 8, 2025
  10. added
    needs-area-label
    on Jul 8, 2025
  11. halter73 commented on Jul 8, 2025

    @halter73
    Member

    I think the issue is that we need to reverse the providers in InternalConfigurationRootExtensions like we do in ConfigurationRootExtensions:

    foreach (IConfigurationProvider provider in root.Providers)

    foreach (IConfigurationProvider provider in root.Providers.Reverse())

  12. added this to the 10.0.0 milestone on Jul 8, 2025
  13. added and removed
    untriaged
    needs-area-label
    on Jul 8, 2025
  14. self-assigned this
    on Jul 8, 2025
  15. dotnet-policy-service commented on Jul 8, 2025

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @dotnet/area-extensions-configuration
    See info in area-owners.md if you want to be subscribed.

  16. ericstj commented on Jul 9, 2025

    @ericstj
    Member

    Thanks for the investigation @halter73! So this regressed because we changed the method that the binder used to fetch (and aggregate) the providers' values and we missed that the existing method would iterate providers in reverse order. We should make sure we add a test for that and fix the order. Thank you for picking this up @tarekgh.

  17. tarekgh commented on Jul 9, 2025

    @tarekgh
    Member
  18. Junjun-zhao commented on Jul 15, 2025

    @Junjun-zhao
    MemberAuthor

    Verified this issue with dotnet-sdk-10.0.100-preview.7.25362.103, it has been fixed.

  19. locked and limited conversation to collaborators on Aug 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions