Error DLL accessing API accessing Microsoft Azure DB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
*ERROR DISPLAYED -I noticed that the IP is not from the micro site but from the API in Azure
System.Net.WebException: Unable to connect to remote server ---> System.Net.Sockets.SocketException: An attempt was made to access a socket in a manner 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 ---
at System.Net.HttpWebRequest.GetResponse()
at MICROCADAPI.MICROCADAPI.NewCmdTESTEHTTP()
at Autodesk.AutoCAD.Runtime.CommandClass.InvokeWorker(MethodInfo mi, Object commandObject, Boolean bLispFunction)
at Autodesk.AutoCAD.Runtime.CommandClass.InvokeWorkerWithExceptionFilter(MethodInfo mi, Object commandObject, Boolean bLispFunction)
at Autodesk.AutoCAD.Runtime.PerDocumentCommandClass.Invoke(MethodInfo mi, Boolean bLispFunction)
----------------------------------------------------------------------------------------------------------------
*API IN THE BROWSER >>> https://microcad.azurewebsites.net/TESTE/T269999 >>> FOUND / NOT FOUND
----------------------------------------------------------------------------------------------------------------
*TEST PROGRAM IN VB.NET
Dim JSURL As String = https://microcad.azurewebsites.net/teste/T269999
ServicePointManager.SecurityProtocol = CType(3072, SecurityProtocolType) '3072=TLS 1.2 / 768=TLS 1.1
Dim request As HttpWebRequest = CType(WebRequest.Create(JSURL), HttpWebRequest)
request.Proxy = Nothing
request.Timeout = 15 * 1000
Dim response As HttpWebResponse = CType(request.GetResponse, HttpWebResponse) '<<< ERROR OCCURS HERE
Dim dataStream As Stream = response.GetResponseStream()
Dim reader As New StreamReader(dataStream)
Dim JSON As String = reader.ReadToEnd()
reader.Close()
response.Close()
----------------------------------------------------------------------------------------------------------------
*CONSIDERATIONS
-On clients that have an error I have tested the API in the browser and it always works.
-In AutoCAD the program is part of a DLL and an error occurs when executed in 5 out of 500 users.
-I made a small program in DLL and the same in EXE according to the code above for testing and the above error occurs with the DLL that runs inside AutoCAD and the EXE that runs outside AutoCAD DOES NOT OCCUR THE ERROR.
----------------------------------------------------------------------------------------------------------------
Grateful,
Felix Melo
Technical / Administrative Director