-
underlying connection was closed:unable to connect to remote server exception message
I have been receiving this exception for over a week with a .NET remoting app and can't find a solution anywhere that works. Below I'll paste my config files and the client code calling the remote method. I'd really appreciate some assistance. The Server code and files are on a remote server within our facility and have been told more than once there is no firewall between my workstation and it. So firewalls are out of the question as the source of the problem. I assume its somewhere in my config files but I've tried everything I've seen on the net.
I receive the Net.WebException: underlying connection was closed:unable to connect to remote server exception message.
Any thoughts?
--------------------------------------------------------------------------------
client config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.runtime.remoting>
<application>
<!-- <channels>
<channel ref="http" port="1234" />
<channel ref="http" port="1235" />
</channels> -->
<client url="http://agiledev2.sanmina-sci.com/DataExtractService">
<wellknown type="AgileExtractNegotiator.ITNSManager, AgileExtractNegotiator"
url="http://agiledev2.sanmina-sci.com:1234/DataExtractService/TNSManager.soap" />
<wellknown type="AgileExtractNegotiator.IDataExtractManager, AgileExtractNegotiator"
url="http://agiledev2.sanmina-sci.com:1234/DataExtractService/DataExtractManager.soap" />
</client>
<channels>
<channel ref="http" />
</channels>
</application>
// <customErrors mode="off"/>
</system.runtime.remoting>
</configuration>
--------------------------------------------------------------------------------
server config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.runtime.remoting>
<application>
<channels>
<channel ref="http" port="1234"/>
</channels>
<lifetime leaseTimeout="20M"
renewOnCallTime="20M"
leaseManagerPollTime="3M" />
<service>
<WellKnown mode="SingleCall"
type="DataExtractServer.DataExtractManager, DataExtractServer"
objectUri="DataExtractManager.soap" />
<WellKnown mode="SingleCall"
type="DataExtractServer.TNSManager, DataExtractServer"
objectUri="TNSManager.soap" />
</service>
</application>
<customErrors mode="Off" />
</system.runtime.remoting>
</configuration>
--------------------------------------------------------------------------------
client code:
Dim app As Windows.Forms.Application
Dim rc As RemotingConfiguration
Dim strConfigFile As String = app.StartupPath.Trim & "\DataExtractLogin.exe.config"
rc.Configure(strConfigFile.Trim)
rc.CustomErrorsEnabled(False)
Dim rh As RemotingHelper = New RemotingHelper
Dim tnsm As ITNSManager = CType(rh.GetObject(GetType(ITNSManager)), ITNSManager)
Dim props As IDictionary = ChannelServices.GetChannelSinkProperties(tnsm)
props("username") = "*********"
props("password") = "********"
Dim TNS As TNSGeneral = New TNSGeneral
Try
TNS = tnsm.GetTNSInfo
Catch rEx As RemotingException
MessageBox.Show("Remoting Exception: " & rEx.Message.Trim, _
"Remoting Service Error", MessageBoxButtons.OK, MessageBoxIcon.Stop, _
MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification)
Exit Sub
Catch argEx As ArgumentException
MessageBox.Show("Exception: " & argEx.Message.Trim & argEx.InnerException.Message)
Exit Sub
Catch aEx As ApplicationException
MessageBox.Show("Exception: " & aEx.Message.Trim & aEx.InnerException.Message)
Exit Sub
Catch nrEx As NullReferenceException
MessageBox.Show("Exception: " & nrEx.Message.Trim & nrEx.InnerException.Message)
Exit Sub
Catch nwEx As Net.WebException
MessageBox.Show("Net Web Exception: " & nwEx.Message.Trim)
Exit Sub
Catch Ex As Exception
MessageBox.Show("Exception: " & Ex.Message.Trim & Ex.InnerException.Message)
Exit Sub
End Try
-
Any proxy servers between you and the remoting server?
Phil Weber
http://www.philweber.com
Please post questions to the forums, where others may benefit.
I do not offer free assistance by e-mail. Thank you!
-
i have a transparent proxy dll on both sides that contains the interface of the implementation on the server. here's relevant code from it, then I'll supply hte server code:
transfer/channel code - transparent proxy
<Serializable()> _
Public Class TNSGeneral
Public OracleHome As String
Public OracleInstances As Collection
End Class
Public Interface ITNSManager
Function GetTNSInfo() As TNSGeneral
'Function GetOracleInstances(ByVal strOracleHome As String) As Collection
'Function GetTNS_fileName() As String
End Interface
<Serializable()> _
Public Class ApplicationServerException
'MustInherit
Inherits ApplicationException
'Implements ISerializable, 'IDeserializationCallback
Private Const _customInfoKey As String = "CustomInfo"
Private _customInfo As String
Public Sub New()
MyBase.New()
End Sub
Public Sub New(ByVal customInfo As String)
MyBase.New(customInfo)
_customInfo = customInfo
End Sub
Protected Sub New(ByVal message As String, ByVal custominfo As String)
MyBase.New(message)
_customInfo = custominfo
End Sub
Protected Sub New(ByVal message As String, ByVal inner As Exception, _
ByVal customInfo As String)
MyBase.New(message, inner)
_customInfo = customInfo
End Sub
Protected Sub New(ByVal info As SerializationInfo, ByVal context As StreamingContext)
MyBase.New(info, context)
_customInfo = info.GetString(_customInfoKey)
End Sub
Public Overrides Sub GetObjectData(ByVal info As SerializationInfo, _
ByVal context As StreamingContext)
'protected?
MyBase.GetObjectData(info, context)
info.AddValue(_customInfoKey, _customInfo)
End Sub
Public Function CustomInfo() As String
Return _customInfo
End Function
End Class
*********************************************************
server code
Imports System
Imports System.Runtime.Remoting
Imports AgileExtractNegotiator
Imports DataExtract
Imports System.Runtime.Remoting.Channels.Http
Imports System.Runtime.Remoting.Channels
Imports System.Security.Principal
Public Class TNSManager
Inherits MarshalByRefObject 'this means that this class doesn't directly inherit from object
Implements ITNSManager
Public Function getTNSInfo() As TNSGeneral Implements ITNSManager.GetTNSInfo
Dim tnsg As TNSGeneral = New TNSGeneral
tnsg.OracleHome = "error"
tnsg.OracleInstances = New Collection
getTNSInfo = tnsg
Dim machinename As String = Environment.MachineName
Dim principal As IPrincipal = System.Threading.Thread.CurrentPrincipal
If Not principal.IsInRole(machinename & "\RemotingUsers") Then
Throw New UnauthorizedAccessException( _
"Unauthorized Access Exception: This user is not in group RemotingUsers")
Exit Function
End If
Dim EOL As String = Environment.NewLine
Dim log As Log.Log = New Log.Log
Dim fs As IO.FileStream = log.OpenLog("server")
Try
fs = log.WriteLog(EOL & EOL & EOL, fs)
fs = log.WriteLog("DataExtractManager called. " & Now.ToString & EOL, fs)
fs = log.WriteLog("Getting Parser object in TNS. " & Now.ToString & EOL, fs)
Dim parser As TNS.ITNS.TNSParser = New TNS.TNS.TNSParser
fs = log.WriteLog("Getting Oracle Home in TNS. " & Now.ToString & EOL, fs)
Dim strOracleHome As String = parser.GetOracleHome.Trim
fs = log.WriteLog("Got Oracle Home in TNS. " & Now.ToString & EOL, fs)
fs = log.WriteLog("Getting Oracle Instances of TNSs in TNS. " & Now.ToString & EOL, fs)
Dim entries As Collection = _
parser.ParseFile(strOracleHome & "\network\admin\tnsnames.ora")
fs = log.WriteLog("Got Oracle Instances of TNSs in TNS. " & Now.ToString & EOL, fs)
Dim entry As TNS.ITNS.TNSEntry = New TNS.TNS.TNSEntry
tnsg.OracleHome = strOracleHome
fs = log.WriteLog("Cycling Oracle Instances of TNSs in TNS. " & Now.ToString & EOL, fs)
tnsg.OracleInstances = New Collection
For Each entry In entries
fs = log.WriteLog("Adding Oracle Instances to TNSGeneral object. " & Now.ToString & EOL, fs)
tnsg.OracleInstances.Add(entry.Name)
fs = log.WriteLog("Added Oracle Instances to TNSGeneral object. " & Now.ToString & EOL, fs)
Next entry
fs = log.WriteLog("Completed adding Oracle Instances into TNSGeneral. " & Now.ToString & EOL, fs)
getTNSInfo = tnsg
' Catch ex As Exception
Catch aEx As ApplicationException
Dim asEx As AgileExtractNegotiator.ApplicationServerException = _
New AgileExtractNegotiator.ApplicationServerException(aEx.Message)
Dim type As Type = System.Type.GetType("System.String")
Dim converter As Runtime.Serialization.IFormatterConverter = _
New Runtime.Serialization.FormatterConverter
Dim si As Runtime.Serialization.SerializationInfo = _
New Runtime.Serialization.SerializationInfo(type, converter)
Dim context As Runtime.Serialization.StreamingContext = _
New Runtime.Serialization.StreamingContext(Runtime.Serialization.StreamingContextStates.All)
asEx.GetObjectData(si, context)
MessageBox.Show(aEx.Message.Trim)
fs = log.WriteLog(aEx.Message.Trim & Now.ToString & EOL, fs)
fs.Close()
fs = Nothing
log = Nothing
Exit Function
End Try
End Function
End Class
-
I didn't mean proxy code, I meant a proxy server (hardware). That's the most common cause of "underlying connection was closed" errors.
Phil Weber
http://www.philweber.com
Please post questions to the forums, where others may benefit.
I do not offer free assistance by e-mail. Thank you!
-
oh sorry phil no. no firewall internally either. its kinda why i'm so baffled.
-
is there anything wrong with the code? i know i'm missing something.
Similar Threads
-
By vbxmax in forum VB Classic
Replies: 2
Last Post: 11-23-2005, 01:21 AM
-
By Will Rickards in forum Database
Replies: 1
Last Post: 04-06-2001, 03:50 PM
-
By andriano in forum Enterprise
Replies: 1
Last Post: 10-02-2000, 03:54 PM
-
Replies: 7
Last Post: 09-15-2000, 08:44 AM
-
By Sam Tran in forum Enterprise
Replies: 0
Last Post: 05-23-2000, 03:23 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|