AuthenticateWithApp throwns NullReferenceException since today

雨燕双飞 提交于 2019-12-02 18:37:49

问题


Since today, we are facing a NullReferenceException when calling the AuthenticateWithApp-function in the .NET-Podio-Client (Newest Version 1.5.8).

I couldn't see an update of the Podio-API or any downtime in the status-website. I guess it must be a problem inside the Podio API.

Anybody with the same problem?

Regards Thorsten


回答1:


Stumbled upon that one too, today. Requests in postman worked Podio .NET library failed. It's caused by an API update by Podio, like @Sara said. Seems my system (and yours too) still defaults to Tls 1.0

Add this at beginning of Main(). This will force at least Tls 1.1.

System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11;

Alternatively you could also set the default like described here:

https://docs.microsoft.com/en-us/dotnet/framework/network-programming/tls




回答2:


We have the same issue, we fixed this by modified the library. Most of our project which uses Podio Sync library. Podio Sync library belongs to Dotnet framework 4.0, so we added a line of code to set default security protocol.

ServicePointManager.SecurityProtocol = (SecurityProtocolType)768 | (SecurityProtocolType)3072;

The changes are done in Podio.cs file line 76

private T Request<T>(RequestMethod requestMethod, string url, dynamic requestData, dynamic options = null)
            where T : new()
        {
            Dictionary<string, string> requestHeaders = new Dictionary<string, string>();

changed to

 private T Request<T>(RequestMethod requestMethod, string url, dynamic requestData, dynamic options = null)
            where T : new()
        {
            ServicePointManager.SecurityProtocol = (SecurityProtocolType)768 | (SecurityProtocolType)3072;

            Dictionary<string, string> requestHeaders = new Dictionary<string, string>();

Hope this will help..


The solution for the SecurityProtocol issue can be found C# HttpWebRequest The underlying connection was closed: An unexpected error occurred on a send




回答3:


I could fix this issue today. The hint on the protocol from @derpirscher was helpful. Because we use .Net 4.0, i had to play around a little bit. But then i came up with this line:

ServicePointManager.SecurityProtocol = (SecurityProtocolType)768 | (SecurityProtocolType)3072;

I inserted this line in the Page_Load-Method of my Default.aspx-Page.

Now the calls to Podio-API are working correctly again. Thanks for help!

Regards Tony



来源:https://stackoverflow.com/questions/51212394/authenticatewithapp-throwns-nullreferenceexception-since-today

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!