question

FelixMelo-4587 avatar image
0 Votes"
FelixMelo-4587 asked SnehaAgrawal-MSFT answered

Error Vb.NET DLL Accessing Query API in Microsoft Azure

When I run a DLL (in AutoCAD) to access a table in my database in Azure the following error occurs:

System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: An attempt was made to access a socket in a way that is prohibited by access permissions 191.235.228.33:443
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
--- End of inner exception stack trace ---

I tested it as an EXE (external executable) and it works.
I tested the API in the browser and it works.
In both cases (DLL and EXE) I tested HttpWebRequest, WebClient, and HttpClient.

The IP presented in the error message I found in my account if service in Microsoft Azure.

Follow the code in VB.NET using HttpWebRequest:

 Dim JSURL As String = "https://microcad.azurewebsites.net/teste/T269999"
 ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls '<<< TSL=1
 Dim request As HttpWebRequest = CType(WebRequest.Create(JSURL), HttpWebRequest)
 request.Credentials = CredentialCache.DefaultCredentials
 request.Proxy = Nothing
 request.Timeout = 15 * 1000
 Dim response As HttpWebResponse = CType(request.GetResponse, HttpWebResponse) '<<<ERROR
 Dim dataStream As Stream = response.GetResponseStream()
 Dim reader As New StreamReader(dataStream)
 Dim JSON As String = reader.ReadToEnd()
 reader.Close()
 response.Close()

Grateful,
FELIX MELO

azure-webappsdotnet-visual-basic
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

SnehaAgrawal-MSFT avatar image
0 Votes"
SnehaAgrawal-MSFT answered

Thanks! looking at the App performance and availability, HTTP 500 error is coming directly from the App Container. HTTP 500.0 error typically indicates an application code issue. An un-handled exception in the application code or an error in application is what typically causes this error. Try checking latest logs from the Application logging.

Also its suggested for applications that are accessed infrequently and are sensitive to start-up delay's, please enable AlwaysOn by following the steps below.

  1. Navigate to the webapp on Azure Portal.

  2. Scroll down in the left hand side menu and click on Configuration.

  3. Navigate to General settings tab.

  4. Set Always on to On under Platform settings.

  5. Click on Save.

Also refer to discussion here might helps.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.