<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Upload Async doesn't work when uploading a file to server in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-Async-doesn-t-work-when-uploading-a-file-to-server/m-p/206180#M10011</link>
    <description>&lt;P&gt;Hello ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to upload a file to dropbox using UploadAsunc method . Everything works fine in the local system. But when i tried to publish and run from the server I'm having an exception or file doesn't get uploaded into the dropbox. Without the dropbox call everything works fine . Here is the code i'm trying to call when uplaoding it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Try
                        Using handler As HttpClientHandler = New HttpClientHandler()
                            Using httpclient As HttpClient = New HttpClient(handler)
                                'httpclient.Timeout = TimeSpan.FromMinutes(20)
                                Dim _DropboxClient = New DropboxClient(ApiKeyDropBox, config)
                                Dim resultstring As String = UploadToDB(_DropboxClient, dropboxdir, docName, fileBytes)
                                _DropboxClient.Dispose()
                                If Not resultstring = "RanToCompletion" Then
                                    ErrorMsg &amp;amp;= "The following error occured: " &amp;amp; resultstring
                                End If
                            End Using

                        End Using
                    Catch ex2 As Dropbox.Api.AuthException
                        ErrorMsg &amp;amp;= "Error details: " &amp;amp; ex2.Message.ToString()
                    Catch ex As HttpException
                        ErrorMsg &amp;amp;= "Error occured saving  file to dropbox.&amp;lt;br /&amp;gt; Error Message: " &amp;amp; ex.InnerException.Message

                    End Try&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt; Private Function UploadToDB(_DropboxClient As DropboxClient, Directory As String, Filename As String, Content As [Byte]()) As String
        Try
            Dim result As String = "Unknown"
            Dim trycnt As String = 0
            Dim tryLimit As String = 20
            Dim respnse As Task(Of FileMetadata)
            Using _mStream = New MemoryStream(Content)
                respnse = _DropboxClient.Files.UploadAsync(Convert.ToString(Directory &amp;amp; Convert.ToString("/")) &amp;amp; Filename, WriteMode.Overwrite.Instance, body:=_mStream)
                While Not respnse.IsCompleted And trycnt &amp;lt; tryLimit
                    Threading.Thread.Sleep(1000)
                    trycnt += 1
                    result = respnse.Status.ToString()
                End While
                UploadToDB = result
            End Using

        Catch ex2 As Dropbox.Api.HttpException
            UploadToDB = ex2.Message.ToString()

        End Try

    End Function&lt;/PRE&gt;&lt;P&gt;Can you please say anything that I am doing worng or what is causing the problem.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the exception thrown :&amp;nbsp;&lt;SPAN&gt;The type initializer for 'Dropbox.Api.DropboxRequestHandlerOptions' threw an exception.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sometimes this is the exception i get:&amp;nbsp;&lt;SPAN&gt;Could not load type 'System.Security.Authentication.SslProtocols' from assembly 'System.Net.Primitives, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 29 May 2019 09:25:59 GMT</pubDate>
    <dc:creator>lakshmak</dc:creator>
    <dc:date>2019-05-29T09:25:59Z</dc:date>
    <item>
      <title>Upload Async doesn't work when uploading a file to server</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-Async-doesn-t-work-when-uploading-a-file-to-server/m-p/206180#M10011</link>
      <description>&lt;P&gt;Hello ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to upload a file to dropbox using UploadAsunc method . Everything works fine in the local system. But when i tried to publish and run from the server I'm having an exception or file doesn't get uploaded into the dropbox. Without the dropbox call everything works fine . Here is the code i'm trying to call when uplaoding it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Try
                        Using handler As HttpClientHandler = New HttpClientHandler()
                            Using httpclient As HttpClient = New HttpClient(handler)
                                'httpclient.Timeout = TimeSpan.FromMinutes(20)
                                Dim _DropboxClient = New DropboxClient(ApiKeyDropBox, config)
                                Dim resultstring As String = UploadToDB(_DropboxClient, dropboxdir, docName, fileBytes)
                                _DropboxClient.Dispose()
                                If Not resultstring = "RanToCompletion" Then
                                    ErrorMsg &amp;amp;= "The following error occured: " &amp;amp; resultstring
                                End If
                            End Using

                        End Using
                    Catch ex2 As Dropbox.Api.AuthException
                        ErrorMsg &amp;amp;= "Error details: " &amp;amp; ex2.Message.ToString()
                    Catch ex As HttpException
                        ErrorMsg &amp;amp;= "Error occured saving  file to dropbox.&amp;lt;br /&amp;gt; Error Message: " &amp;amp; ex.InnerException.Message

                    End Try&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt; Private Function UploadToDB(_DropboxClient As DropboxClient, Directory As String, Filename As String, Content As [Byte]()) As String
        Try
            Dim result As String = "Unknown"
            Dim trycnt As String = 0
            Dim tryLimit As String = 20
            Dim respnse As Task(Of FileMetadata)
            Using _mStream = New MemoryStream(Content)
                respnse = _DropboxClient.Files.UploadAsync(Convert.ToString(Directory &amp;amp; Convert.ToString("/")) &amp;amp; Filename, WriteMode.Overwrite.Instance, body:=_mStream)
                While Not respnse.IsCompleted And trycnt &amp;lt; tryLimit
                    Threading.Thread.Sleep(1000)
                    trycnt += 1
                    result = respnse.Status.ToString()
                End While
                UploadToDB = result
            End Using

        Catch ex2 As Dropbox.Api.HttpException
            UploadToDB = ex2.Message.ToString()

        End Try

    End Function&lt;/PRE&gt;&lt;P&gt;Can you please say anything that I am doing worng or what is causing the problem.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the exception thrown :&amp;nbsp;&lt;SPAN&gt;The type initializer for 'Dropbox.Api.DropboxRequestHandlerOptions' threw an exception.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sometimes this is the exception i get:&amp;nbsp;&lt;SPAN&gt;Could not load type 'System.Security.Authentication.SslProtocols' from assembly 'System.Net.Primitives, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:25:59 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-Async-doesn-t-work-when-uploading-a-file-to-server/m-p/206180#M10011</guid>
      <dc:creator>lakshmak</dc:creator>
      <dc:date>2019-05-29T09:25:59Z</dc:date>
    </item>
    <item>
      <title>Re: Upload Async doesn't work when uploading a file to server</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-Async-doesn-t-work-when-uploading-a-file-to-server/m-p/206231#M10020</link>
      <description>Dropbox does use SSL/TLS for all API calls, so your system needs to be able to make SSL/TLS connections. Based on the error message, it seems something went wrong loading System.Security.Authentication.SslProtocols. That seems to be a issue with your system itself though, not Dropbox, so I'm afraid I can't offer much insight. This question may be better suited for a Microsoft support channel or forum.</description>
      <pubDate>Fri, 10 Feb 2017 18:38:44 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-Async-doesn-t-work-when-uploading-a-file-to-server/m-p/206231#M10020</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2017-02-10T18:38:44Z</dc:date>
    </item>
    <item>
      <title>Re: Upload Async doesn't work when uploading a file to server</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-Async-doesn-t-work-when-uploading-a-file-to-server/m-p/206232#M10021</link>
      <description>Thank you</description>
      <pubDate>Fri, 10 Feb 2017 18:40:45 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-Async-doesn-t-work-when-uploading-a-file-to-server/m-p/206232#M10021</guid>
      <dc:creator>lakshmak</dc:creator>
      <dc:date>2017-02-10T18:40:45Z</dc:date>
    </item>
  </channel>
</rss>

