Error connecting to Sharepoint site from Powershell - powershell

Since a few days back I started receiving the below error when I try to connect to Sharepoint site.
System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
As per the documentation below I tried making the registry changes below and ran below Powershell command, restarted the server but still receiving the same error. Has anything changed recently?
https://learn.microsoft.com/en-us/sharepoint/troubleshoot/administration/authentication-errors-tls12-support
https://learn.microsoft.com/en-us/mem/configmgr/core/plan-design/security/enable-tls-1-2-client#configure-for-strong-cryptography
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v2.0.50727]
"SystemDefaultTlsVersions" = dword:00000001
"SchUseStrongCrypto" = dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319]
"SystemDefaultTlsVersions" = dword:00000001
"SchUseStrongCrypto" = dword:00000001
Enable-TlsCipherSuite -Name "TLS_DHE_DSS_WITH_AES_256_CBC_SHA"

Try adding below line of code before connecting to SharePoint Site:
PowerShell
[System.Net.ServicePointManager]::SecurityProtocol =
[System.Net.SecurityProtocolType]::Tls12;
.NET
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
This should work for you.
Update:
Added PowerShell equivalent code.

Related

OTRS Mailfetching issue

I have issue with OTRS version 6 which is running on ubuntu 16.04.
OTRS didn't fetch the mail properly whenever i tried to fetch the mail it through below error
" OTRS-otrs.Console.pl-Maint::PostMaster::MailAccountFetch-77[5799]: [Error][Kernel::System::Daemon::DaemonModules::BaseTaskWorker::_HandleError][Line:52]: There was an error executing Execute() in Kernel::System::Console::Command::Maint::PostMaster::MailAccountFetch: Error: Timeout of 600 seconds reached, killing child process!"
I tried below steps:
Tried to reconfigure fetchmail:bin not success
Tried to add new param in Daemon: "ArtticlIndex rebuild" add new param "--force-pid"
3.Restart the server from remote console
How to fix this issue? please guide me on this.

Enable TLS 1.2 on windows 10 64-bit + check if it is enabled or not

I want to run my PS1 files which connect to SharePoint online, the script keeps raising this error:-
Message: The underlying connection was closed: An unexpected error occurred on a send.
now based on my readings that one reason for getting this error is that we need to enable TLS 1.2 on the client , as mentioned in this link # https://learn.microsoft.com/en-us/mem/configmgr/core/plan-design/security/enable-tls-1-2-client ..
so i tried the steps mentioned in the link, where i added the register key under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\WinHttp but i can not find this HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Internet Settings\WinHttp as there is no folder named WinHttp under internet settings... Can anyone advice?on this , why my windows 10 does not have the second registry path + are there other steps that i need to do to enable TLS 1.2 ?
Thanks
To ensure TLS 1.2 is used, add this anywhere before the first request you make.
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Vscode snippet
If you are using vscode, here is the code for a snippet, so you can quickly add this in your code whenever needed.
"tls12": {
"prefix": "tls12",
"body": "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12"
},

Socket error 10053 software caused connection abort

I have a application which will receive files from FTP and uploaded in to Mainframe server.
I am getting a "Socket error 10053 software caused connection abort" when I assign
FTPTransfertype = ftASCII
If I change this to FtBinary I'm not getting this error but data not uploaded properly in this mode.
I am getting this error only in application server (Production server) not in the development server (here I faced this issue only once in the FTPTransfertype = ftASCII assignment)
I have changed the FTP connectivity mode to Passive but its not working..
Please help me on this.
I recomment to see Microsoft Windows Socket Errors page:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms740668(v=vs.85).aspx
In your case:
Software caused connection abort. An established connection was
aborted by the software in your host computer, possibly due to a data
transmission time-out or protocol error.

No connection could be made because the target machine actively refused it 127.0.0.1:25

I get this error while running web services using a web application.
No connection could be made because the target machine actively refused it 127.0.0.1:8083
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:8083
Source Error:
Line 108: [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/VerifyFingerPrint", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
Line 109: public string VerifyFingerPrint([System.Xml.Serialization.XmlElementAttribute(DataType="base64Binary")] byte[] VeriBmp, string empcode) {
Line 110: object[] results = this.Invoke("VerifyFingerPrint", new object[] {
Line 111: VeriBmp,
Line 112: empcode});
Source File: D:\Mayuri1working\BOBFingerPrint\BOBFingerPrint\Web References\localhost\Reference.cs Line: 110
Please help !
First update your web service references used in your application.
If web service references are not get updated, then check all files and folder containing source code files in your web service project solution and rebuild it and then update web references used in your project.
Else if its working fine then you need to check your network services used by your development server and windows firewall settings as suggested in above solutions.
I also encountered same problem and I came to know that I was referencing wrong folder having same name but used in another solution.
Enjoy codding.

EF4 EntityException - The underlying provider failed on Open

Okay, this is a new one. I'm trying to debug my project, which I've done many times in the past, and I'm now getting this exception in one of my repositories. I haven't seen it before now. I haven't touched my repos in days, and my connection string is the same as its always been. The inner exception states:
{"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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)"}
And the code it's choking on is:
public class HGArticleRepository : IArticleRepository
{
private HGEntities _siteDB = new HGEntities();
public List<Article> Articles
{
get { return _siteDB.Articles.ToList(); } // <-- this is the line
}
// more repo code
}
Again, like I said, I've never encountered this exception before, and I haven't touched my domain code in days.
This error usually means:
Connection String points to nonexistent SQL Server.
Connection String points to SQL Server that was shut down. Or not started.
Named pipes transport was disabled in SQL Server settings.
Check them carefully one by one. In your case I guess it is 2.
A second option of solution:
Review that IIS is running.
In my case it was stopped, so I got the same error.