Base solution for your next web application
Open Closed

Can't register user in Azure #4501


User avatar
0
affern created

I have got a strange issue. My solution works local, but in Azure I can not register new users. But I can log in and do other things. My log-file in Azure is also emty. But the Azure application log gives me this output: <h3>HTTP Error 500.0 - Internal Server Error</h3> <h4>The page cannot be displayed because an internal server error has occurred.</h4> </div> <div class="content-container"> <fieldset><h4>Most likely causes:</h4> <ul> <li>IIS received the request; however, an internal error occurred during the processing of the request. The root cause of this error depends on which module handles the request and what was happening in the worker process when this error occurred.</li> <li>IIS was not able to access the web.config file for the Web site or application. This can occur if the NTFS permissions are set incorrectly.</li> <li>IIS was not able to process configuration for the Web site or application.</li> <li>The authenticated user does not have permission to use this DLL.</li> <li>The request is mapped to a managed handler but the .NET Extensibility Feature is not installed.</li> </ul> </fieldset> </div> <div class="content-container"> <fieldset><h4>Things you can try:</h4> <ul> <li>Ensure that the NTFS permissions for the web.config file are correct and allow access to the Web server's machine account.</li> <li>Check the event logs to see if any additional information was logged.</li> <li>Verify the permissions for the DLL.</li> <li>Install the .NET Extensibility feature if the request is mapped to a managed handler.</li> <li>Create a tracing rule to track failed requests for this HTTP status code. For more information about creating a tracing rule for failed requests, click <a href="http://go.microsoft.com/fwlink/?LinkID=66439">here</a>. </li> </ul> </fieldset> </div>

<div class="content-container"> <fieldset><h4>Detailed Error Information:</h4> <div id="details-left"> <table border="0" cellpadding="0" cellspacing="0"> <tr class="alt"><th>Module</th><td>   AspNetCoreModule</td></tr> <tr><th>Notification</th><td>   ExecuteRequestHandler</td></tr> <tr class="alt"><th>Handler</th><td>   aspNetCore</td></tr>

Anybody have any suggestions? How can I enable the log-file ?


14 Answer(s)
  • User Avatar
    0
    alirizaadiyahsi created

    If you can't see logs in *.Host/App_Data/Logs/Logs.txt, could you make sure that folder read/write permissions are given?

  • User Avatar
    0
    affern created

    This is from the log: ERROR 2018-01-15 12:40:31,414 [11 ] Mvc.ExceptionHandling.AbpExceptionFilter - An attempt was made to access a socket in a way forbidden by its access permissions 127.0.0.1:25 System.Net.Internals.SocketExceptionFactory+ExtendedSocketException (0x80004005): An attempt was made to access a socket in a way forbidden by its access permissions 127.0.0.1:25 at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.Sockets.Socket.Connect(EndPoint remoteEP) at System.Net.Sockets.Socket.Connect(IPAddress address, Int32 port) at MailKit.Net.Smtp.SmtpClient.Connect(String host, Int32 port, SecureSocketOptions options, CancellationToken cancellationToken) at MailKit.MailService.Connect(String host, Int32 port, Boolean useSsl, CancellationToken cancellationToken) at Abp.MailKit.DefaultMailKitSmtpBuilder.ConfigureClient(SmtpClient client) at Abp.MailKit.DefaultMailKitSmtpBuilder.Build() at Abp.MailKit.MailKitEmailSender.BuildSmtpClient() at Abp.MailKit.MailKitEmailSender.<SendEmailAsync>d__4.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Net.Mail.EmailSenderBase.<SendAsync>d__8.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at MyApp.Authorization.Users.UserEmailer.<ReplaceBodyAndSend>d__18.MoveNext() in D:\MyApp\aspnet-core\src\MyApp.Core\Authorization\Users\UserEmailer.cs:line 317 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at MyApp.Authorization.Users.UserEmailer.<SendEmailActivationLinkAsync>d__9.MoveNext() in D:\MyApp\aspnet-core\src\MyApp.Core\Authorization\Users\UserEmailer.cs:line 101 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Threading.InternalAsyncHelper.<AwaitTaskWithPostActionAndFinally>d__1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at MyApp.Authorization.Users.UserRegistrationManager.<RegisterAsync>d__13.MoveNext() in D:\MyApp\aspnet-core\src\MyApp.Core\Authorization\Users\UserRegistrationManager.cs:line 100 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at MyApp.Authorization.Accounts.AccountAppService.<Register>d__16.MoveNext() in D:\MyApp\aspnet-core\src\MyApp.Application\Authorization\Accounts\AccountAppService.cs:line 76 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at lambda_method(Closure , Object ) at Microsoft.Extensions.Internal.ObjectMethodExecutorAwaitable.Awaiter.GetResult() at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeActionMethodAsync>d__12.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextActionFilterAsync>d__10.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeInnerFilterAsync>d__14.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.<InvokeNextExceptionFilterAsync>d__23.MoveNext()

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    It seems like sending email fails. You need to configure smtp settings on Host > Settings page.

  • User Avatar
    0
    affern created

    Ok. I did'nt think I needed to configure that since I unchecked "Email confirmation required for login". I try to look for what kind of smtp info I need to register here: <a class="postlink" href="https://www.aspnetzero.com/Documents/Development-Guide-Core">https://www.aspnetzero.com/Documents/De ... Guide-Core</a>, but I can't find anything. When do I need to check the field "Use SSL"? And what kind of user is the field in "Use default credentials"? Sorry if these are stupid questions :?

  • User Avatar
    0
    affern created

    When I try with my providers smtp settings and my user, I get an error:

    MailKit.Net.Smtp.SmtpCommandException: sender IP address 52.164.206.54 is part of Microsoft Azure, and may not use this server as a smarthost. Azure servers should use a smarthost service (<a class="postlink" href="https://blogs.msdn.microsoft.com/mast/2016/04/04/sending-e-mail-from-azure-compute-resource-to-external-domains/">https://blogs.msdn.microsoft.com/mast/2 ... l-domains/</a>) at MailKit.Net.Smtp.SmtpClient.OnRecipientNotAccepted(MimeMessage message, MailboxAddress mailbox, SmtpResponse response) at MailKit.Net.Smtp.SmtpClient.ProcessRcptToResponse(MimeMessage message, MailboxAddress mailbox, SmtpResponse response) at MailKit.Net.Smtp.SmtpClient.FlushCommandQueue(MimeMessage message, MailboxAddress sender, IList1 recipients, CancellationToken cancellationToken) at MailKit.Net.Smtp.SmtpClient.Send(FormatOptions options, MimeMessage message, MailboxAddress sender, IList1 recipients, CancellationToken cancellationToken, ITransferProgress progress) at MailKit.Net.Smtp.SmtpClient.Send(FormatOptions options, MimeMessage message, CancellationToken cancellationToken, ITransferProgress progress) at MailKit.MailTransport.Send(MimeMessage message, CancellationToken cancellationToken, ITransferProgress progress) at MailKit.MailTransport.<>c__DisplayClass2_0.<SendAsync>b__0() at System.Threading.Tasks.Task.InnerInvoke() at System.Threading.Tasks.Task.<>c.<.cctor>b__276_1(Object obj) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.MailKit.MailKitEmailSender.<SendEmailAsync>d__4.MoveNext() --- End of stack trace from previous loc...

  • User Avatar
    0
    affern created

    Now I get this:

    System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure. at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, ExceptionDispatchInfo exception) at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.PartialFrameCallback(AsyncProtocolRequest asyncRequest) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Net.Security.SslState.InternalEndProcessAuthentication(LazyAsyncResult lazyResult) at System.Net.Security.SslState.EndProcessAuthentication(IAsyncResult result) at System.Net.Security.SslStream.EndAuthenticateAsClient(IAsyncResult asyncResult) at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar...

  • User Avatar
    0
    strix20 created

    Which SMTP provider are you using? Are they configured to use TLS or SSL? Do they require Authentication? Did you provide the correct authentication credentials if so?

  • User Avatar
    0
    affern created

    My SMTP provider is Domeneshop. It works fine from my local machine.

    I think Azure's new restrictions are the cause of my problem: <a class="postlink" href="https://blogs.msdn.microsoft.com/mast/2017/11/15/enhanced-azure-security-for-sending-emails-november-2017-update/">https://blogs.msdn.microsoft.com/mast/2 ... 17-update/</a>

  • User Avatar
    0
    affern created

    I changed to use Azure SendGrid service instead. Now it works. Case closed :)

  • User Avatar
    0
    Mitch created

    Hi

    I'm using Azure too so I think I'm going to hit the same problems. Can you tell me how you setup SendGrid to work with ASP.Net Zero?

    I really appreciate your help in advance.

    Mitch

  • User Avatar
    0
    alper created
    Support Team

    hi, SendGrid is a special Azure service for sending emails. You can use that service but you don't have to use it. The problem in the first post was; Azure prohibits some ports and might be blocking port 25 (email protocol port). So you need to explicitly allow that port in Firewall settings adding a new rule. This is a standard Azure challenge, out of AspNet Zero scope.

  • User Avatar
    0
    affern created

    <cite>Mitch: </cite> Hi

    I'm using Azure too so I think I'm going to hit the same problems. Can you tell me how you setup SendGrid to work with ASP.Net Zero?

    I really appreciate your help in advance.

    Mitch

    @Mitch Hi. Did you solve it? These two links maybe helpful: <a class="postlink" href="https://stackoverflow.com/questions/17666161/sending-email-from-azure">https://stackoverflow.com/questions/176 ... from-azure</a> <a class="postlink" href="https://docs.microsoft.com/en-us/azure/sendgrid-dotnet-how-to-send-email">https://docs.microsoft.com/en-us/azure/ ... send-email</a>

  • User Avatar
    0
    Mitch created

    Thanks for your replies. I have used SendGrid in a previous project so I do have some experience with it. My issue was where is the best place to put the code within ASP. Net Zero?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @Mitch,

    You just need to implement ISmtpEmailSender with your own version. You can put this implementation into the *.Core project.

    Then replace default sender in the core module's PreInitialize method like below;

    Configuration.ReplaceService<ISmtpEmailSender , MySmtpEmailSender >(DependencyLifeStyle.Transient);