SQL Server – Database Mail Stops After Browser Service Stopped

connectivitydatabase-mailsql server

After stopping the browser service on a 2-node SQL Server failover cluster system, the Database Mail component stopped working. It fails and creates log entries as follows:

Microsoft.SqlServer.Management.SqlIMail.Server.Common.BaseException
Message: There was an error on the connection.
Reason: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible.
Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 – Error Locating Server/Instance Specified), connection parameters:
Server Name: SQLCLNETWORK1\INSTANCE1,
Database Name: msdb
Source: DatabaseMailEngine

The instance behind "SqlClNetwork01" is running on non default Port. The SQL Server engine itself continued without any problems.

So my question is, why does the Mail Service have issues with the browser service stopped? Where is it trying to connect to the SQL Server engine without success?

Best Answer

It has issues because it would use the instance name rather than a port number, and the Browser service is required to do translation from instances to ports. Your other apps must be hardcoded to use the port numbers (or have aliases set in their SQL Client settings, or something similar).

Anyway when a mail is sent this triggers MSSQL\Binn\DatabaseMail.exe to run. I wasn't able to find out how it specifically works out what the default server name is, but you may be able to reconfigure it by creating an MSSQL\Binn\DatabaseMail.exe.config like this on each node, and including a port number:

<configuration>
    <appSettings>
        <add key="DatabaseServerName" value ="LocalServerName" />
        <add key="DatabaseName" value ="msdb" />
    </appSettings>
</configuration>