DocuSign API C#抛出无法连接到用于.net框架4.7 webapi的远程服务器应用程序



当从Docusign请求JWT令牌时,出现无法连接到远程服务器的异常。

"向服务器"请求时出错;

这个问题适用于.net框架4.7.2 webapi项目,但当尝试从.net core 3.1 webapp请求JWT令牌时,它是成功的。

net框架web应用程序项目需要做什么设置吗?

如果你想看到一些使用.NET框架而不是.NET核心的代码-https://github.com/docusign/code-example-net-framework-auth-code-grant这段代码使用的是Auth-code Grant,而不是JWT,因为这与.NET Core和MVC的.NET Framework不同。获取JWT令牌的代码对于.NET核心和.NET框架是相同的。这是代码:

this._authToken = _apiClient.RequestJWTUserToken(
this._configuration["DocuSignJWT:ClientId"],
this._configuration["DocuSignJWT:ImpersonatedUserId"],
this._configuration["DocuSignJWT:AuthServer"],
DSHelper.ReadFileContent(DSHelper.PrepareFullPrivateKeyFilePath(this._configuration["DocuSignJWT:PrivateKeyFile"])), 1, scopes);
_account = GetAccountInfo(_authToken);

最后一个建议,尝试DocuSign VS扩展。它还支持.NET Core和.NET Framework。

你可以在GitHub中找到C#代码-https://github.com/docusign/code-examples-csharp/blob/master/launcher-csharp/Common/JWTAuth.cs

最新更新