Box.V2 boxClient.Auth.AuthenticateAsync is throwing "An error occurred while sending the request"
schandra09net opened this issue · comments
Hello Team,
We are using Box.V2 in my C# WPF application, and while invoking below method getting this exception ,
Intialization to get AuthCode:
var boxConfig = new BoxConfig(_boxAppClientID, _boxAppClientSecret, new Uri(_boxAppReturnUrl));
_boxClient = new BoxClient(boxConfig, session);
Try to get AccessToken:
{"An error occurred while sending the request."}
Data: {System.Collections.ListDictionaryInternal}
HResult: -2146233088
HelpLink: null
InnerException: {"The request was aborted: Could not create SSL/TLS secure channel."}
Message: "An error occurred while sending the request."
Source: "Microsoft.Threading.Tasks"
StackTrace: " at Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at Microsoft.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task)\r\n at Box.V2.Auth.AuthRepository.d__17.MoveNext()\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n at Content.ContentProviderModule.Providers.BoxContentProvider.<b__14_0>d.MoveNext() in D:\Comapny\Content\Modules\ContentProviderModule\Providers\BoxContentProvider.cs:line 119"
TargetSite: {Void ThrowForNonSuccess(System.Threading.Tasks.Task)}
Can you please let me know?
Hi @schandra09net,
It's look like due to TLS conflict you are not able to make a connection to the server.
- Can you specify what Windows version and .NET framework you are using?
- Is there any place in your WPF app where you set ServicePointManager.SecurityProtocol property?
- Can you also put this line
Console.WriteLine(ServicePointManager.SecurityProtocol);
in youcatch
blok and show us what it prints for further investigation?
Hi @arjankowski:
Thanks for your reply, and answers below
-
Is there any place in your WPF app where you set ServicePointManager.SecurityProtocol property?
No results found in Visual Studio with search "ServicePointManager.SecurityProtocol" or "ServicePointManager" or "ServicePointManager.SecurityProtocol" -
Can you also put this line Console.WriteLine(ServicePointManager.SecurityProtocol); in you catch blok and show us what it prints for further investigation?
Please suggest.
Hi @arjankowski:
After adding this line in try block, issue is resolved, and getting all the box items.
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
Thank you.
This issue has been automatically marked as stale because it has not been updated in the last 30 days. It will be closed if no further activity occurs within the next 7 days. Feel free to reach out or mention Box SDK team member for further help and resources if they are needed.