0

Error: An error occurred while receiving the HTTP response

We have an Azure AppService that communicates with web services that are hosted on-premise via a Site-to-Site VPN. We are using a HUB and SPOKE model for the Site-to-Site VPN set up and this web app integrates with one of the subnets that is part of SPOKE VNet. We have gotten the following exception while performing end-to-end testing. Hope this blog helps you save some research time. Good luck!

Exception:

An error occurred while receiving the HTTP response to https://yourwebserviceURL. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive.

Inner exception:

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 at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.FixedSizeReader.ReadPacket(Byte[] buffer, Int32 offset, Int32 count)
at System.Net.Security._SslStream.StartFrameHeader(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)at System.Net.Security._SslStream.StartReading(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)at System.Net.Security._SslStream.ProcessRead(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)at System.Net.TlsStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.PooledStream.Read(Byte[] buffer, Int32 offset, Int32 size) at System.Net.Connection.SyncRead(HttpWebRequest request, Boolean userRetrievedStream, Boolean probeRead)

Solution:

You might find a lot of solutions online suggesting to update the web.config, edit the binding etc. none of them worked for me. By default, Azure app routes only RFC1918 traffic into your VNet. If you want to route all of your outbound traffic into your VNet, use the following steps to add the WEBSITE_VNET_ROUTE_ALL setting in your app:

WEBSITE_VNET_ROUTE_ALL = 1

References:

https://docs.microsoft.com/en-us/azure/app-service/web-sites-integrate-with-vnet

0

Some files can harm your computer in SharePoint 2013 (Internet Explorer Only!)

We had the below annoying pop showing up for some users while opening documents within SharePoint 2013.  Surprisingly this issue DOES NOT occur while accessing the same document from a Document Library. But when opening this document from a SharePoint page or a link within a Content Search or Content Query web part the below message pops up.

Some Files Can Harm Your Computer

Following are some of the alternative solutions that were listed in various forums/blogs that might help resolve your issue. But not for me. I have listed the actual solution at the very end.

Solution 1: Add URL to trusted sites.

Add the URL to the trusted sites on Internet Explorer. If this is working for you, you should work with your company to push this as a group policy or something to update for all users. Unfortunately, this did not work for me. I already had the site URL in the trusted sites.

Solution 2: Disable SharePoint OpenDocument Class Add-on for Internet Explorer

Disable SharePoint OpenDocument Class Add-on for Internet Explorer. This works 100%. But we can’t expect every user to do this and has to be pushed via a Group Policy or something. Also, we do not want to deal with consequences of disabling this Add-on. I do not want to go into the details of this Add-On, for now, I will save this as a topic for another blog.

SharePoint OpenDocuments Class

Solution 3: Follow the blog

Solution 4: Add script to suppress calls to Add-on (Worked For me!!)

The following screen capture explains it all. The issue is not occurring within a document library because the ‘onmousedown’ and ‘click‘ events are NOT calling the Add-On see below.

But on the page the link with in Content Query results, the ‘onmousedown’ and ‘click‘ events are calling the Add-On in IE (Internet Explorer).

SharePoint OpenDocuments Class Script

 

Script:

So as a solution we have added a script on to the master page with identifies anchor tags that are pointing to PDF files and replaces text within the two attributes as shown below.


<script type="text/javascript">
var replaceStrings = ["SharePoint.OpenDocuments.3", "SharePoint.OpenDocuments"];
var anchorAttributes = ["onclick", "onmousedown"];
$(document).ready(function () {
$('a[href*="pdf"]').each(function () {
for (var i = 0; i < anchorAttributes.length; i++) {
for (var j = 0; j < replaceStrings.length; j++) {
var value = $(this).attr(anchorAttributes[i]);
if (value) {
$(this).attr(anchorAttributes[i], value.replace(replaceStrings[j], ''));
}
}
console.log($(this).attr(anchorAttributes[i]));
}
});
});
</script>