Hello,
I've got the following error if I run the unittest on my TFS-server. Error Message: 2017-01-23T08:10:58.9421026Z ##[error] System.Net.Mail.SmtpException : Failure sending mail. 2017-01-23T08:10:58.9421026Z ##[error]---- System.Net.WebException : Unable to connect to the remote server 2017-01-23T08:10:58.9421026Z ##[error]-------- System.Net.Sockets.SocketException : No connection could be made because the target machine actively refused it 127.0.0.1:25
The error threw on the "Tests.Authorization.Accounts.AccountAppService_Tests.Should_Register" function but if I run the test on my local machine they passed all without errors.
2017-01-23T08:06:07.0135202Z ##[section]Starting: Test Assemblies \release***Tests.dll;-:\obj** 2017-01-23T08:06:07.0293371Z ============================================================================== 2017-01-23T08:06:07.0293371Z Task : Visual Studio Test 2017-01-23T08:06:07.0293371Z Description : Run tests with Visual Studio test runner 2017-01-23T08:06:07.0293371Z Version : 1.0.84 2017-01-23T08:06:07.0293371Z Author : Microsoft Corporation 2017-01-23T08:06:07.0293371Z Help : [More Information](<a class="postlink" href="https://go.microsoft.com/fwlink/?LinkId=624539">https://go.microsoft.com/fwlink/?LinkId=624539</a>) 2017-01-23T08:06:07.0293371Z ============================================================================== 2017-01-23T08:06:07.0603836Z Preparing task execution handler. 2017-01-23T08:06:07.8572704Z Executing the powershell script: C:\agent_work_tasks\VSTest_ef087383-ee5e-42c7-9a53-ab56c98420f9\1.0.84\VSTest.ps1 2017-01-23T08:06:09.2166613Z Working folder: C:\agent_work\1\s 2017-01-23T08:06:09.2166613Z Executing C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe "C:\agent_work\1\s\LignaSystems.PM\test\Tests\bin\Release\net461\Tests.dll" "C:\agent_work\1\s\LignaSystems.PM\test\Tests\bin\Release\net461\win7-x64\Tests.dll" /logger:trx /TestAdapterPath:"C:\agent_work\1\s\LignaSystems.PM\test\Tests\packages" 2017-01-23T08:06:09.5135524Z Microsoft (R) Test Execution Command Line Tool Version 14.0.25420.1 2017-01-23T08:06:09.5135524Z Copyright (c) Microsoft Corporation. All rights reserved. 2017-01-23T08:06:09.5135524Z 2017-01-23T08:06:09.8416774Z Starting test execution, please wait... 2017-01-23T08:06:11.6542052Z Information: [xUnit.net 00:00:01.2808557] Discovering: Tests 2017-01-23T08:06:11.6542052Z 2017-01-23T08:06:13.9667328Z Information: [xUnit.net 00:00:03.6089250] Discovered: Tests 2017-01-23T08:06:13.9667328Z 2017-01-23T08:06:15.2011263Z Information: [xUnit.net 00:00:04.8332378] Starting: Tests 2017-01-23T08:06:15.2011263Z
2017-01-23T08:10:58.9421026Z Failed Tests.Authorization.Accounts.AccountAppService_Tests.Should_Register
2017-01-23T08:10:58.9421026Z ##[error]Error Message:
2017-01-23T08:10:58.9421026Z ##[error] System.Net.Mail.SmtpException : Failure sending mail.
2017-01-23T08:10:58.9421026Z ##[error]---- System.Net.WebException : Unable to connect to the remote server
2017-01-23T08:10:58.9421026Z ##[error]-------- System.Net.Sockets.SocketException : No connection could be made because the target machine actively refused it 127.0.0.1:25
2017-01-23T08:10:58.9421026Z ##[error]Stack Trace:
2017-01-23T08:10:58.9421026Z ##[error] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
2017-01-23T08:10:58.9421026Z ##[error] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2017-01-23T08:10:58.9421026Z ##[error] at Abp.Net.Mail.Smtp.SmtpEmailSender.<SendEmailAsync>d__3.MoveNext()
2017-01-23T08:10:58.9421026Z ##[error]--- End of stack trace from previous location where exception was thrown ---
2017-01-23T08:10:58.9421026Z ##[error] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
2017-01-23T08:10:58.9421026Z ##[error] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2017-01-23T08:10:58.9421026Z ##[error] at Abp.Net.Mail.EmailSenderBase.<SendAsync>d__6.MoveNext()
2017-01-23T08:10:58.9421026Z ##[error]--- End of stack trace from previous location where exception was thrown ---
2017-01-23T08:10:58.9421026Z ##[error] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
2017-01-23T08:10:58.9421026Z ##[error] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2017-01-23T08:10:58.9577164Z ##[error] at Abp.Net.Mail.EmailSenderBase.<SendAsync>d__4.MoveNext()
2017-01-23T08:10:58.9577164Z ##[error]--- End of stack trace from previous location where exception was thrown ---
2017-01-23T08:10:58.9577164Z ##[error] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
2017-01-23T08:10:58.9577164Z ##[error] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2017-01-23T08:10:58.9577164Z ##[error] at Abp.Net.Mail.EmailSenderBase.<SendAsync>d__2.MoveNext()
2017-01-23T08:10:58.9577164Z ##[error]--- End of stack trace from previous location where exception was thrown ---
2017-01-23T08:10:58.9577164Z ##[error] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
2017-01-23T08:10:58.9577164Z ##[error] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2017-01-23T08:10:58.9577164Z ##[error] at Authorization.Users.UserEmailer.<SendEmailActivationLinkAsync>d__5.MoveNext() in C:\agent_work\1\s\LignaSystems.PM\src\Core\Authorization\Users\UserEmailer.cs:line 88
2017-01-23T08:10:58.9577164Z ##[error]--- End of stack trace from previous location where exception was thrown ---
2017-01-23T08:10:58.9577164Z ##[error] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
2017-01-23T08:10:58.9577164Z ##[error] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2017-01-23T08:10:58.9577164Z ##[error] at Abp.Threading.InternalAsyncHelper.<AwaitTaskWithPostActionAndFinally>d__1.MoveNext()
2017-01-23T08:10:58.9577164Z ##[error]--- End of stack trace from previous location where exception was thrown ---
2017-01-23T08:10:58.9577164Z ##[error] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
2017-01-23T08:10:58.9577164Z ##[error] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2017-01-23T08:10:58.9577164Z ##[error] at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
2017-01-23T08:10:58.9577164Z ##[error] at Authorization.Users.UserRegistrationManager.<RegisterAsync>d__11.MoveNext() in C:\agent_work\1\s\LignaSystems.PM\src\Core\Authorization\Users\UserRegistrationManager.cs:line 85
2017-01-23T08:10:58.9577164Z ##[error]--- End of stack trace from previous location where exception was thrown ---
2017-01-23T08:10:58.9577164Z ##[error] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
2017-01-23T08:10:58.9577164Z ##[error] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2017-01-23T08:10:58.9577164Z ##[error] at Authorization.Accounts.AccountAppService.<Register>d__14.MoveNext() in C:\agent_work\1\s\LignaSystems.PM\src\Application\Authorization\Accounts\AccountAppService.cs:line 69
2017-01-23T08:10:58.9577164Z ##[error]--- End of stack trace from previous location where exception was thrown ---
2017-01-23T08:10:58.9577164Z ##[error] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
2017-01-23T08:10:58.9577164Z ##[error] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2017-01-23T08:10:58.9577164Z ##[error] at Abp.Threading.InternalAsyncHelper.<AwaitTaskWithPostActionAndFinallyAndGetResult>d__51.MoveNext() 2017-01-23T08:10:58.9577164Z ##[error]--- End of stack trace from previous location where exception was thrown --- 2017-01-23T08:10:58.9577164Z ##[error] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 2017-01-23T08:10:58.9577164Z ##[error] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 2017-01-23T08:10:58.9577164Z ##[error] at Abp.Threading.InternalAsyncHelper.<AwaitTaskWithFinallyAndGetResult>d__3
1.MoveNext()
2017-01-23T08:10:58.9577164Z ##[error]--- End of stack trace from previous location where exception was thrown ---
2017-01-23T08:10:58.9577164Z ##[error] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
2017-01-23T08:10:58.9577164Z ##[error] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2017-01-23T08:10:58.9577164Z ##[error] at Tests.Authorization.Accounts.AccountAppService_Tests.<Should_Register>d__4.MoveNext() in C:\agent_work\1\s\LignaSystems.PM\test\Tests\Authorization\Accounts\AccountAppService_Tests.cs:line 55
2017-01-23T08:10:58.9577164Z ##[error]--- End of stack trace from previous location where exception was thrown ---
2017-01-23T08:10:58.9577164Z ##[error] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
2017-01-23T08:10:58.9577164Z ##[error] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2017-01-23T08:10:58.9577164Z ##[error]--- End of stack trace from previous location where exception was thrown ---
2017-01-23T08:10:58.9577164Z ##[error] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
2017-01-23T08:10:58.9577164Z ##[error] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2017-01-23T08:10:58.9577164Z ##[error]--- End of stack trace from previous location where exception was thrown ---
2017-01-23T08:10:58.9577164Z ##[error] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
2017-01-23T08:10:58.9577164Z ##[error] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2017-01-23T08:10:58.9577164Z ##[error]----- Inner Stack Trace -----
2017-01-23T08:10:58.9577164Z ##[error] at System.Net.Mail.SmtpConnection.ConnectAndHandshakeAsyncResult.End(IAsyncResult result)
2017-01-23T08:10:58.9577164Z ##[error] at System.Net.Mail.SmtpTransport.EndGetConnection(IAsyncResult result)
2017-01-23T08:10:58.9577164Z ##[error] at System.Net.Mail.SmtpClient.ConnectCallback(IAsyncResult result)
2017-01-23T08:10:58.9577164Z ##[error]----- Inner Stack Trace -----
2017-01-23T08:10:58.9577164Z ##[error] at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
2017-01-23T08:10:58.9577164Z
2017-01-23T08:11:00.1764820Z Information: [xUnit.net 00:04:49.8057195] Finished: Tests 2017-01-23T08:11:00.1764820Z 2017-01-23T08:11:00.4533075Z Passed Tests.Orte.OrteWebAPIClient_Tests.PLZByLandId 2017-01-23T08:11:02.2947203Z Results File: C:\agent_work\1\s\TestResults\chef_SERVER-WEB 2017-01-23 09_06_37.trx 2017-01-23T08:11:02.2947203Z 2017-01-23T08:11:02.2947203Z Total tests: 93. Passed: 91. Failed: 1. Skipped: 1. 2017-01-23T08:11:02.2947203Z ##[error] at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)Test Run Failed. 2017-01-23T08:11:02.2947203Z Test execution time: 4,8668 Minutes 2017-01-23T08:11:02.4822124Z ##[error]System.Exception: VSTest Test Run failed with exit code: 1 2017-01-23T08:11:02.5290753Z Publishing Test Results... 2017-01-23T08:11:04.5896005Z Test results remaining: 93 2017-01-23T08:11:06.8017130Z Published Test Run : <a class="postlink" href="https://web-constructions.visualstudio.com/web-constructions/_TestManagement/Runs#runId=33&_a=runCharts">https://web-constructions.visualstudio. ... =runCharts</a> 2017-01-23T08:11:06.8173459Z ##[error]PowerShell script completed with 1 errors. 2017-01-23T08:11:06.8173459Z ##[section]Finishing: Test Assemblies \release***Tests.dll;-:\obj**
1 Answer(s)
-
0
Hi,
In your machine, unit tests are runned in debug mode and in debug mode nullEmailSender is used. It just writes logs to a log file.
But it seems like your TFS server runs unit tests in release mode. In release mode StmpEmailSender class is used and it tries to send a real email. Because of that it tries to use 127.0.0.1:25 to send an email and fails.
You can try to run unit tests on TFS server in debug mode or you can configure a real smtp server to test sending of emails. It is up to you :). We an try to help if you face any problems on doing that.