The RPC server is unavailable. (Exception from HRESULT: 0x800706BA) - networking

Occasionally I get this error when working on remote computers. It's hit or miss on which computer I get it on. But I am able to ping the computer and test-connection pans out. For example, the computer I got this error on today I was able to get to yesterday. I know the computer is on because It's right next me.
Get-WmiObject : The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
At line:1 char:14
+ get-wmiObject <<<< -Class win32_operatingsystem -ComputerName $current -Authentication 6 -credential $credential | Invoke-WMIMethod -name Win32Shutdown
+ CategoryInfo : InvalidOperation: (:) [Get-WmiObject], COMException
+ FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands.GetWmiObjectCommand

Check to see if the Remote Procedure Call (RPC) service is running. If it is, then it's a firewall issue between your workstation and the server. You can test it by temporary disabling the firewall and retrying the command.
Edit after comment:
Ok, it's a firewall issue. You'll have to either limit the ports WMI/RPC work on, or open a lot of ports in the McAfee firewall.
Here are a few sites that explain this:
Microsoft KB for limiting ports
McAfee site talking about the same thing

You may get your answer here: Get-WmiObject : The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
UPDATE
It might be due to various issues.I cant say which one is there in your case. It may be because:
DCOM is not enabled in host pc or target pc or on both
your firewall or even your antivirus is preventing the access
any WMI related service is disabled
Some WMI related services are:
Remote Access Auto Connection Manager
Remote Access Connection Manager
Remote Procedure Call (RPC)
Remote Procedure Call (RPC) Locator
Remote Registry
For DCOM settings refer to registry key HKLM\Software\Microsoft\OLE, value EnableDCOM. The value should be set to 'Y'.

My problem turned out to be blank spaces in the txt file that I was using to feed the WMI Powershell script.

I had the same problem when trying to run a PowerShell script that only looked at a remote server to read the size of a hard disk.
I turned off the Firewall (Domain networks, Private networks, and Guest or public network) on the remote server and the script worked.
I then turned the Firewall for Domain networks back on, and it worked.
I then turned the Firewall for Private network back on, and it also worked.
I then turned the Firewall for Guest or public networks, and it also worked.

Duting create cluster, my error was:
An error occurred while creating the cluster.
Could not determine Management Point Network Type.
The RPC server is unavailable
Solution:
Server Manager
Local Server
Click on one of the network adapter links, like "Ethernet".
Control Panel\Network and Internet\Network Connections
Right click on the first network adapter
Internet Protocol Version 4 (TCP/IPv4)
Properties
Advanced
DNS
Click radio button:
Append primary and connection specific DNS suffixes

If anyone else is reading this eons later. My problem was I deployed a GPO a few months ago that disables printer spooling via Windows Firewall rules. One of the rules is "File and printer sharing (Spooler Service - RPC-EPMAP)". This was set to deny.
This blocked the "RPC Endpoint Mapper" port range inbound and didn't specify a service. As a result this was blocking all traffic inbound on all RPC ports (tcp 1024-5000).
Disables the rule and this magically started working again.
TLDR; You need to allow the RPC Endpoint Mapper port range inbound on Windows firewall (tcp 1024-500) along with the WMI-In rule.

Related

Can not connect to sql server from docker supported asp.net core project [duplicate]

This question already has answers here:
Can't connect to SQL Server express from .net core app running on docker
(4 answers)
Closed last month.
I have a ASP.NET Core 2.2 project for which I turned on docker support. The project runs fine as long as it does not require database connection. For e.g Login. When I enter user credentials, I get the error as below.
An unhandled exception occurred while processing the request.
Win32Exception: A connection attempt failed because the connected
party did not properly respond after a period of time, or established
connection failed because connected host has failed to respond
Unknown location SqlException: 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: TCP Provider, error: 0 - A connection attempt
failed because the connected party did not properly respond after a
period of time, or established connection failed because connected
host has failed to respond.)
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity
identity, SqlConnectionString connectionOptions, object providerInfo,
bool redirectedUserInstance, SqlConnectionString
userConnectionOptions, SessionData reconnectSessionData, bool
applyTransientFaultHandling) InvalidOperationException: An exception
has been raised that is likely due to a transient failure. If you are
connecting to a SQL Azure database consider using
SqlAzureExecutionStrategy.
Microsoft.EntityFrameworkCore.Storage.Internal.SqlServerExecutionStrategy+d__7.MoveNext()
Previously the error was different when TCP/IP was not enabled in my sql server configuration manager.(Do not remember error)
I followed the steps mentioned in the link https://jack-vanlightly.com/blog/2017/9/24/how-to-connect-to-your-local-sql-server-from-inside-docker to solve that issue.
I have enabled TCP/IP and named pipes as well. Also I can connect using IP from SQL Management Studio.
Current connection string:
"ConnectionStrings": {
"DefaultConnection": "Server=xxx.xx.xx.x,1433;Database=TestDB;User ID=username;Password=pwd;Trusted_Connection=True;MultipleActiveResultSets=true"
},
Please let me know if I am missing any step. I want to connect to a local sql from my docker project
This took me some time to work out, there are a number of small issues that may be wrong, which makes it frustrating. This can get even more frustrating as the .net core web application visual studio 2017 project that gets auto-generated doesn't work straight out of the box. Having this experience as your first exposure to Docker isn't ideal.
I initially also had the incorrect assumption that the docker image would come with SQL Server inside the container, this is not the case, it's trying to access the database server that must be pre-installed on the host machine.
Steps to follow (tested for a windows docker image, rather than linux);
Get the IP address of your host machine, by running a command prompt and typing IPCONFIG
Set the database connection string within you appsettings.json file to this Ip address, followed by the SQL Server port number, i.e.;
192.168.X.X,1433
Set the connection string not to use Trusted_Connection (delete this from the connection string) and hard code in the User Id and Password;
User Id=sa;Password=SuperSecurePassword;
If I didn't do this, on certain SQL Server configurations I'd get an unusual error. EDIT: the error
Cannot authenticate using Kerberos. Ensure Kerberos has been initialized on the client with 'kinit' and a Service Principal Name has been registered for the SQL Server to allow Kerberos authentication.
Connection String show look something like this;
"Server=192.168.X.X,1433;Database=MyDatabase;User Id=sa;Password=SuperSecurePassword;MultipleActiveResultSets=true"
now on the host machine you need to open up the windows firewall, and add a new inbound connection rule, for TCP port 1433.
After all this, and it still doesn't work, try a reboot; I struggled for a long time and had to reboot, which brought it into life; I'm not sure Docker had initialised correctly, this is mostly speculation though! I don't really like to say rebooting is a fix for problems, it's not really an answer, but in certain cases it does the trick.
edit, one final thing, running visual studio in administrator mode (right click icon, "run as administrator") helps too.
Apologises for the resurrection of an old thread, but this issue seems to still exist and the information available is a bit patchy on how to fix this, considering the small number of things that need to be done.
So what has worked for me is:
public static string DockerHostMachineIpAddress => Dns.GetHostAddresses(new Uri("http://docker.for.win.localhost").Host)[0].ToString();
docker.for.win.localhost is an address that inner dns of docker will resolve as localhost (not localhost inside docker but the hosting machine). The above code provides u with an ip address of your localhost and you are able to create connection string like this:
$"Server={DockerHostMachineIpAddress}\\SQL2017;Database=YourDB;User Id=Admin;Password=123;"
This will work if you are using named sql server instance - replace SQL2017 with ur instance name and crediatials with correct user.
HOWEVER!
For migrations and update-database localhost works fine. Probably since its not handled from docker container.
EDIT:
Second solution is a bit cleaner but you need to have a project that supports docker-compose.
In docker-compose.yml file in definition of your service below image property definition add:
extra_hosts:
- "localhost:192.168.65.2"
You still have to know what IP address (which you can find out by using the original answer) you have to add alias for, but once you know it it's a bit more clean. On more than 5 different machines that I worked on this IP is correct.
I ran into the same problem, and followed all the steps mentioned by Phil but I still could not solve this.
Finally, in addition to the steps in the specified answer, I had to enable my SQL Server for TCP protocol by following these steps.
1. Open SQL Server Configuration Manager
2. Select "SQL Server Network Configuration" > "Protocols for MSSQLSERVER"
3. Edit "TCP/IP" properties, and change "Enabled" to "Yes"
I had the same issue, followed the same approach as on the website you mentioned. It should work like that if you have the networks with standard configuration.
Simply disable the firewall for your public network.
My issue was simply, that windows seemed to classify the network created by Docker as public network and so the firewall blocked it, same as for this one:
Can't connect to SQL Server express from .net core app running on docker
It's not marked there as an answer but rather edited in the question.

Configure MS DTC over VPN

I tried to configure MS DTC via our VPN. But when I try to open the connection it gives me the following error.
The MSDTC transaction manager was unable to push the transaction to the destination transaction manager due to communication problems. Possible causes are: a firewall is present and it doesn't have an exception for the MSDTC process, the two machines cannot find each other by their NetBIOS names, or the support for network transactions is not enabled for one of the two transaction managers. (Exception from HRESULT: 0x8004D02A)
When I check with the network team they told me that the firewall is already configured to allow DTC.
If I explain this further this communication is done via VPN. According to my network admin, although the client machine could see the NetBios name of the server but server cannot see the client's NetBios name, when this communication is done through a firewall/router. He is telling that, to start a DTC communication both machines should be able to see their NetBios names.
I tried with DTCPing (Same setup) and the dtc ping error is
03-04, 10:18:33.918-->RPC server:NGSVR received following information:
Network Name: NGSVR
Source Port: 49179
Partner LOG: WS-PCSPOS76036.log
Partner CID: EBA77A41-C9F9-4162-B7A2-E10404719072
++++++++++++Start Reverse Bind Test+++++++++++++
Received Bind call from WS-PCSPOS7
Network Name: NGSVR
Source Port: 49179
Hosting Machine:NGSVR
03-04, 10:18:33.996-->Trying to Reverse Bind to WS-PCSPOS7...
Test Guid:EBA77A41-C9F9-4162-B7A2-E10404719072
gethostbyname can not resolve WS-PCSPOS7
Error(0xB7) at nameping.cpp #43
-->gethostbyname failure
-->183(Cannot create a file when that file already exists.)
Can not resolve WS-PCSPOS7
Error(0x6BA) at ServerManager.cpp #453
-->RPC reverse BIND failed
-->1722(The RPC server is unavailable.)
Reverse Binding to WS-PCSPOS7 Failed
In GUID
Out GUID
Reverse BIND FAILED
Session Down
I have tried to open and do a transaction via non vpn setup and it was successful.
Can we configure MS DTC via VPN?
If it is possible any additional configuration should do to VPN?

Remote debugging ASP.NET applications on a server with static IP address

All of examples on web assume the remote server which we are going to debug remotely is on the same network. I have only a static IP address and using RDP I connect to server.
I've installed Remote Debugger on remote machine but cannot set the static IP address as Qualifier in visual studio -> debug -> attach to process
The username#machinename construct displayed in msvsmon is the text that needs to go into the Qualifier box in Visual Studio -> Attach to Process.
For example, where msvsmon says:
msvsmon started a new server named 'tf#macmini'. Waiting for new connections.
you would type tf#macmini into the qualifier box.
For a machine out on the internet, I'd guess you use username#[ip address here], e.g.
tf#123.234.32.1
Though you will need to make sure, at a minimum, firewalls and authentication are set up correctly. (The debugging will not occur via RDP.) There's an article on the firewall side of this here. Can't remember off the top what the authentication involves, although I suspect as a minimum you will need an account on both machines with the same username and password.

Getting a sql connection error when trying to login

I have a login page that works in my local development environment. When I push the site onto the web server, i am getting this error when trying to login from the asp.net login control.
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
I cannot figure out why it does not work on the server. Do I need to add anything or change something in the web.config?
This support article may help. It may also be a firewall issue or an authentication issue on the new setup (but the error message makes that less likely).
For resolving error 26 in sql server you need to do the following steps.
At Server System
1. Under surface area configuration manager-Open up remote connections.
2. Add into firewall 1433 and 1434 port no as n exception.
3. Open port 1433 on router for WAN access.
4. Add client machine ip address as an exception to your antivirus or allow LAN settings in antivirus.
5. Now try to check if both client and server are connected to each other.
for this type "ping IP address of remote system" at run and if reply is obtained then do same for server machine.
If reply is obtained from both machines.
Open Sql server and try to connect to remote machine which allow remote connections using its ip address. U will surely get connected to server machine
See this video
Check to make sure TCP/IP is enabled on the SQL Server. For whatever reason, named pipes and TCP/IP is off by default. Also make sure you are trying to connect to the correct instance (maybe you are using ./SQLEXPRESS locally and on the server SQL is installed on the default instance). Lastly, make sure the database you are trying to connect to exists on the server.

"Communication with the underlying transaction manager has failed" error message

A client of our has recently upgraded a ASP.NET 1.1 web application to ASP.NET that uses COM+ transaction processing and received the following exception while trying to process a transaction:
Exception Type:
System.Transactions.TransactionManagerCommunicationException
Message: Communication with the
underlying transaction manager has
failed.
Inner Exception Type:
System.Runtime.InteropServices.COMException
ErrorCode: -2147467259
Message: Error
HRESULT E_FAIL has been returned from
a call to a COM component.
Here are the following settings on MSDTC Security Settings:
-- Network DTC Access
-- Allow Inbound
-- Allow Outbound
-- Incoming Caller Authenication Required
A Windows XP SP3 workstation is trying to establish a connection to a Windows Server 2003 machine.
Has anyone else experienced this error and know how to resolve it.
You'll need to have network DTC access enabled on both your XP workstation and your windows 2003 machine. Also, if your application is only published internally, you can turn off incoming caller authentication and set it to "no authentication".
Add C:\Windows\msdtc.exe to the firewall exceptions on both the firewall and server. I spent ages monkeying around opening specific port numbers and ranges to no avail before I did this.
1)Disable authentication besides enabling the network access to "distributed transaction co-ordination " service
(mutual authentication doesn’t work as displayed in internet in xp sp3 machines)
2) enable network access in client ( web applicaton ) and server ( sql server ) machines for "distributed transaction co-ordination " service .
You'll also need to make sure your firewall is open for ports 135 and 5000-5020.
See these:
http://social.msdn.microsoft.com/forums/en-US/windowstransactionsprogramming/thread/71f7a219-c85d-4a04-973b-c73464f59606/
http://blogs.msdn.com/florinlazar/archive/2005/09/16/469064.aspx
http://social.msdn.microsoft.com/forums/en-US/architecturegeneral/thread/7731d7a7-a9ad-42e7-b0bb-f3656b870304/
http://support.microsoft.com/kb/154596/
In case you need help finding the MSDTC settings mentioned in the other answers (like I did), the following link explains how to configure MSDTC on server 2003.
http://itknowledgeexchange.techtarget.com/sql-server/how-to-configure-dtc-on-windows-2003/

Resources