Forum Discussion
Unexpected error: The underlying connection was closed: An unexpected error occurred on a send
Hi aill,
Since some time now I've been running into issues to connect to Sharepoint and Onedrive urls in Power BI Desktop.
After I publish the report to the service the refresh works fine, so it seems to be something particular to my device.
The device doesn't have any connectivity issues outside Power BI nor to other data sources. Also I didn't make any changes, suddenly this issue appeared for all sharepoint / onedrive connections.
I have tried many things until now, applying solutions from this forum and also rasied a ticket with Microsoft Support for O365, but they didn't want to help as it did not seems to be a problem with my tenant / account...
The issue
When trying to access data on sharepoint via Power BI, the error is not always the same, nor does it occur at the same point in the process.
Sometimes an error already occurs when I try to authenticate, the login.microsoft url doesn't load and states an error about TLS settings. If I then retry to sign in a couple of times, at some point the tool will let me authenticate (30% of the tries).
However, on report refresh in Power BI Desktop, I will get this error for all sharepoint queries in that report (100% of the time).
Looking into the Power Query editor, I see that the data is sometimes loaded normally, so the authentication did pass and data is returned, no errors whatsoever.
However if I then click 'refresh preview' the query result will sometimes suddenly return the same error as with the report refresh:
Less often, I get the long long error statement below this post. If I then hit refresh preview a view times more it will at some point again show my data as normal. How can that possibly be???
As mentioned I already tried a lot of things:
- Uninstall third party security software + turn off firewall entirely
- Uninstall and reinstall network adapter driver
- Try different MS accounts, connecting to different Sharepoint tenants
- Use a different browser, clear browser cache
- Reinstall browsers, reinstall Power BI Desktop
- Try a different device: with a different laptop, I can connect just fine, thus seems to be a device issue but I didn't make any changes. Error occured 'out of nowhere'.
- Play around with TLS settings, eventhough they were already at defaults (TLS1.0, 1.1, 1.2 checked, SSL 3.0 unchecked)
However, all these solutions didn't work. Also, do note that the device doesn't have any other connectivity issues, and the data is sometimes shown in the PQ editor, just the full refresh never works.
> I then even did a full reset to factory settings for the Laptop. WIndows 11 Home 22H2, Acer Predator.
As you might understand, I have already put a lot of time into this issue and tried all sorts of solutions.
However, I really need this solved for my work with clients, I'd rather not throw away this otherwise perfectly working laptop.
Is there someopne who knows of different causes / solution or ideally how I can get a support call with someone who might know more about this? As mentioned I tried with MS 365 as I have a subscription, but they turned me down.
>> error I receive in PQ editor (not always, just sometimes)
Unexpected error: The underlying connection was closed: An unexpected error occurred on a send.
Details:
Microsoft.Mashup.Evaluator.Interface.ErrorException: The underlying connection was closed: An unexpected error occurred on a send. ---> Microsoft.Mashup.Engine1.Library.Http.ResponseException: The underlying connection was closed: An unexpected error occurred on a send. ---> Microsoft.Mashup.Engine1.Library.Http.ResponseException: The underlying connection was closed: An unexpected error occurred on a send. ---> 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
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
--- End of inner exception stack trace ---
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.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest, Boolean renegotiation)
at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Net.TlsStream.ProcessAuthentication(LazyAsyncResult result)
at System.Net.TlsStream.Write(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.PooledStream.Write(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.ConnectStream.WriteHeaders(Boolean async)
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.GetResponse()
at Microsoft.Mashup.Engine1.Library.Http.WrappingHttpWebRequest.<>c__DisplayClass119_0.<WrapResponse>b__0()
at Microsoft.Mashup.Engine1.Library.Http.WrappingHttpWebRequest.WrapExceptionResponse[T](Func`1 getValue)
at Microsoft.Mashup.Engine1.Library.Http.Request.CreateResponse(ResourceCredentialCollection credentials)
at Microsoft.Mashup.Engine1.Library.Http.Request.GetResponseCore(ResourceCredentialCollection credentials)
at Microsoft.Mashup.Engine1.Library.Http.RetryPolicy.Execute[TResult](IEngineHost host, Func`1 func)
at Microsoft.Mashup.Engine1.Library.Http.Request.GetResponse(ResourceCredentialCollection credentials, RetryPolicy retryPolicy, SecurityExceptionCreator securityExceptionCreator, Boolean tokenRefreshed)
--- End of inner exception stack trace ---
at Microsoft.Mashup.Engine1.Library.Http.Request.GetResponse(ResourceCredentialCollection credentials, RetryPolicy retryPolicy, SecurityExceptionCreator securityExceptionCreator, Boolean tokenRefreshed)
at Microsoft.Mashup.Engine1.Library.SharePoint.SharePointFile.TryGetWebFullUrl(Uri uri, ResourceCredentialCollection credentials, IEngineHost host, Boolean tokenRefreshed)
at Microsoft.Mashup.Engine1.Library.SharePoint.SharePointFile.GetCsomFileUrl(IEngineHost host, TextValue url, ResourceCredentialCollection credentials)
at Microsoft.Mashup.Engine1.Library.Web.WebModule.WebContentsFunctionValue.TypedInvoke(TextValue url, Value options)
at Microsoft.Mashup.Engine1.Runtime.NativeFunctionValue2`3.Invoke(Value arg0, Value arg1)
at Microsoft.Mashup.Engine1.Language.MembersFunctionValue1.Invoke(Value arg0)
at Microsoft.Mashup.Engine1.Language.RecordInstruction.RuntimeRecordValue.Force(Int32 index)
at Microsoft.Mashup.Engine1.Language.RecordInstruction.RuntimeRecordValue.get_Item(Int32 index)
at Microsoft.Mashup.Engine1.Language.MembersFunctionValue1.Invoke(Value arg0)
at Microsoft.Mashup.Engine1.Language.RecordInstruction.RuntimeRecordValue.Force(Int32 index)
at Microsoft.Mashup.Engine1.Language.RecordInstruction.RuntimeRecordValue.get_Item(Int32 index)
at Microsoft.Mashup.Engine1.Runtime.RecordValue.RecordValueReference.get_Value()
at Microsoft.Mashup.Engine1.Runtime.RecordValue.ReferenceArrayRecordValue.get_Item(Int32 index)
at Microsoft.Mashup.Engine1.Runtime.RecordValue.TryGetValue(String key, Value& value)
at Microsoft.Mashup.Engine1.Runtime.OptionalFieldAccessValueReference.GetValue()
at Microsoft.Mashup.Engine1.Runtime.FieldAccessValueReference.get_Value()
at Microsoft.Mashup.Engine1.Runtime.RecordValue.ReferenceArrayRecordValue.get_Item(Int32 index)
at Microsoft.Mashup.Engine1.Language.FunctionInvocationInstruction1.Execute(Value frame)
at Microsoft.Mashup.Engine1.Runtime.TransformValueReference.get_Value()
at Microsoft.Mashup.Engine1.Runtime.RecordValue.ReferenceArrayRecordValue.get_Item(Int32 index)
at Microsoft.Mashup.Engine1.Language.Query.ExpandListColumnQuery.<GetRowsets>d__47.MoveNext()
at Microsoft.Mashup.Engine1.Language.Query.ExpandListColumnQuery.<GetRows>d__40.MoveNext()
at Microsoft.Mashup.Engine1.Language.Query.SelectRowsQuery.SelectRowsEnumerable.SelectRowsEnumerator.MoveNext()
at Microsoft.Mashup.Engine1.Language.Query.SelectRowsQuery.SelectRowsEnumerable.SelectRowsEnumerator.MoveNext()
at Microsoft.Mashup.Engine1.Language.Query.ExpandListColumnQuery.<GetRowsets>d__47.MoveNext()
at Microsoft.Mashup.Engine1.Language.Query.ExpandListColumnQuery.<GetRows>d__40.MoveNext()
at Microsoft.Mashup.Engine1.Runtime.SkipTakeEnumerator`1.MoveNext()
at Microsoft.Mashup.Evaluator.SimpleDocumentEvaluator.ValuePreviewValueSource.TableValuePreviewValueSource.SerializeRows(Int32 count)
at Microsoft.Mashup.Evaluator.SimpleDocumentEvaluator.ValuePreviewValueSource.TableValuePreviewValueSource.get_SmallValue()
at Microsoft.Mashup.Evaluator.Interface.TracingPreviewValueSource.get_SmallValue()
at Microsoft.Mashup.Evaluator.RemotePreviewValueSource.<>c__DisplayClass0_0.<RunStub>b__0()
at Microsoft.Mashup.Evaluator.EvaluationHost.ReportExceptions(String entryName, IEngineHost engineHost, IMessageChannel channel, Action action)
--- End of inner exception stack trace ---
at Microsoft.Mashup.Evaluator.EvaluationHost.<>c__DisplayClass17_0.<TryReportException>b__1()
at Microsoft.Mashup.Common.SafeExceptions.IgnoreSafeExceptions(IEngineHost host, IHostTrace trace, Action action)
at Microsoft.Mashup.Evaluator.EvaluationHost.TryReportException(IHostTrace trace, IEngineHost engineHost, IMessageChannel channel, Exception exception)
at Microsoft.Mashup.Evaluator.EvaluationHost.ReportExceptions(String entryName, IEngineHost engineHost, IMessageChannel channel, Action action)
at Microsoft.Mashup.Evaluator.RemoteDocumentEvaluator.Service.<>c__DisplayClass12_1`1.<OnBeginGetResult>b__0()
at Microsoft.Mashup.Evaluator.EvaluationHost.ReportExceptions(IHostTrace trace, IEngineHost engineHost, IMessageChannel channel, Action action)
at Microsoft.Mashup.Evaluator.RemoteDocumentEvaluator.Service.OnBeginGetResult[T](IMessageChannel channel, BeginGetResultMessage message, Action`1 action)
at Microsoft.Mashup.Evaluator.RemoteDocumentEvaluator.Service.OnBeginGetPreviewValueSource(IMessageChannel channel, BeginGetPreviewValueSourceMessage message)
at Microsoft.Mashup.Evaluator.MessageHandlers.TryDispatch(IMessageChannel channel, Message message)
at Microsoft.Mashup.Evaluator.ChannelMessenger.ChannelMessageHandlers.TryDispatch(IMessageChannel channel, Message message)
at Microsoft.Mashup.Evaluator.MessageHandlers.Dispatch(IMessageChannel channel, Message message)
at Microsoft.Mashup.Evaluator.ChannelMessenger.OnMessageWithUnknownChannel(IMessageChannel baseChannel, MessageWithUnknownChannel messageWithUnknownChannel)
at Microsoft.Mashup.Evaluator.MessageHandlers.TryDispatch(IMessageChannel channel, Message message)
at Microsoft.Mashup.Evaluator.ChannelMessenger.ChannelMessageHandlers.TryDispatch(IMessageChannel channel, Message message)
at Microsoft.Mashup.Evaluator.MessageHandlers.Dispatch(IMessageChannel channel, Message message)
at Microsoft.Mashup.Evaluator.EvaluationHost.Run()
at Microsoft.Mashup.Container.EvaluationContainerMain.Run(Object args)
at Microsoft.Mashup.Evaluator.SafeThread2.<>c__DisplayClass9_0.<CreateAction>b__0(Object o)
at Microsoft.Mashup.Container.EvaluationContainerMain.SafeRun(String[] args)
at Microsoft.Mashup.Container.EvaluationContainerMain.Main(String[] args)
--- End of inner exception stack trace ---
at Microsoft.Mashup.Evaluator.EvaluationHost.OnException(IEngineHost engineHost, IMessageChannel channel, ExceptionMessage message)
at Microsoft.Mashup.Evaluator.MessageHandlers.TryDispatch(IMessageChannel channel, Message message)
at Microsoft.Mashup.Evaluator.MessageHandlers.Dispatch(IMessageChannel channel, Message message)
at Microsoft.Mashup.Evaluator.ChannelMessenger.ChannelMessageHandlers.TryDispatch(IMessageChannel channel, Message message)
at Microsoft.Mashup.Evaluator.MessageHandlers.Dispatch(IMessageChannel channel, Message message)
at Microsoft.Mashup.Evaluator.Interface.IMessageChannelExtensions.WaitFor[T](IMessageChannel channel)
at Microsoft.Mashup.Evaluator.RemotePreviewValueSource.PreviewValueSource.WaitFor(Func`1 condition, Boolean disposing)
at Microsoft.Mashup.Evaluator.RemotePreviewValueSource.PreviewValueSource.get_SmallValue()
at Microsoft.Mashup.Evaluator.Interface.TracingPreviewValueSource.get_SmallValue()
at Microsoft.Mashup.Host.Document.Analysis.PackageDocumentAnalysisInfo.PackagePartitionAnalysisInfo.SetPreviewValue(EvaluationResult2`1 result, Func`1 getStaleSince, Func`1 getSampled)
2 Replies
- AnonymousNot applicable
Hi Koen_PoweredBy ,
Here I will give you some suggestions.
1. As far as I know, your issue will be caused by old version TLS.
Support for transport layer security (TLS) 1.0 and 1.1 for Power BI will end in June 2020. Upgrade the TLS version of your Power BI application to TLS 1.2 before then.
Solution: Adding followung code
System.Net.ServicePointManager .SecurityProtocol = SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
Follow below post suggested by microsoft support team:
https://azure.microsoft.com/en-in/updates/power-bi-support-for-transportlayer-security/
2. You can clear permissions in Data source setting , then load the new credential to sharepoint and Onedrive and try again.
3. Download the latest Power BI Desktop version and try again.
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Koen_PoweredByFrequent Visitor
Hi, thanks for your response.
1) Does this also apply to running a report refresh in Power BI Desktop? As I don't believe I am runninga Power BI 'application'. If it does apply, where / how should I apply that code? The post itself doesn't state that in enough detail for me to understand. I'm not an app developer.
In the internet options of my laptop I already have TLS 1.2 enabled (default settings).
2) I think that by this point I've cleared the permissions over a thousand times... I did so after every time after making any changes to my settings such as, clearing browser cache, changing default browser, uninstalling network driver, reseting the entire device to factory settings etc etc. It hasn't resolved my issue just yet.
3) I've already tried to re-install Power BI, I also tried an older version, but I get the same result. Also after the full laptop reset I did another re-install. The microsoft store version gives the same result as well.
Thanks again for your response though. Any other ideas? Please do note my first post where I listed the solutions I've already tried so far.