Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The request was cancelled due to the configured httpclient.timeout of 100 seconds elapsing #464

Open
bipinshan opened this issue Aug 29, 2024 · 7 comments

Comments

@bipinshan
Copy link

bipinshan commented Aug 29, 2024

Dot NET Core 8.0
Windows
BackgroundService
C#

Microsft.PowerPlatform.Dataverse.Client Latest version

Connection String - Auth Type = OAuth
I am using sample App Id provided by Microsoft https://learn.microsoft.com/en-us/power-apps/developer/data-platform/xrm-tooling/use-connection-strings-xrm-tooling-connect#create-a-connection-string

Hosted on Private Cloud Foundry (PCF)

Failed to connect to Dataverse:
The request was cancelled due to the configured httpclient.timeout of 100 seconds elapsing

Error Requesting Access Token

Dependency Injection is not used in my sample code.

Please help us to troubleshoot and fix this issue.

I have tried using http://localhost for RedirectUril property but getting same error.

Note - code works fine when I execute from my machine on VS 2022

I tried passing ILogger to log detailed error but no help.

@MattB-msft
Copy link
Member

Hi @bipinshan,
You cannot use oAuth + Background services unless you configure authprompt=never and pass the password.
background services cannot present a user interaction dialog.

You will either need to use AuthType ClientSecret or ClientCertificate to connect to dataverse from a non-interactive service.

@bipinshan
Copy link
Author

Hi @MattB-msft ,

Thank you for replying to my query.

I did use authprompt=never and passing password in connection String but I am still seeing the same error.

@MattB-msft
Copy link
Member

MattB-msft commented Aug 30, 2024 via email

@bipinshan
Copy link
Author

Hi @MattB-msft ,

I am in the process of provisioning an application user. I will try and let you the outcome.

@bipinshan
Copy link
Author

Hi @MattB-msft ,
So I tried clientsecret auth type today and it failed with the same error.

Error Requesting token

Any idea why it is failing?

@MattB-msft
Copy link
Member

Sorry for the delay in responding.
in this case, You should make sure your logging out the trace log from the client and have added "MSALLogPII" true in your appconfig , or set it as part of your constructor. That will help provide the full stack trace of what is going on with the MSAL auth flow.

Alternatively you can set up a standalone project to create an authentication token for the remote service and use that to debug the issue. To do that, You would utilize the samples and doc's from the MSAL.net git hub to setup that sample. You can find an example of that here: https://learn.microsoft.com/entra/msal/dotnet/getting-started/instantiate-confidential-client-config-options

@bjm3819
Copy link

bjm3819 commented Oct 9, 2024

Were having a similar error message but related to proxy..

Were using ServiceClient in a web app. The web app lives in a EC2. The company uses a proxy.
I also have a .net core console app, this app on the same EC2 can get out to the dataverse/dynamics endpoint when setting the env http proxy variables. However, the web site cannot, it's httpclient connection under the hood of the ServiceClient type times out.

What can we do?
Were using a Amazon Linux 2023.3.20240312 and have also tried Red Hat Enterprise Linux 8.10 (Ootpa)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants