all groups > dotnet remoting > june 2006 >
You're in the

dotnet remoting

group:

Exception: The method '.ctor' was not found on the interface/type



Exception: The method '.ctor' was not found on the interface/type eric.means NO[at]SPAM gmail.com
6/29/2006 8:25:36 AM
dotnet remoting: I have a client-activated object that is failing with a
RemotingException. The exception's message is "The method '.ctor' was
not found on the interface/type 'My.Type, MyTypeLibrary,
Version=1.0.2371.15203, Culture=neutral, PublicKeyToken=null'.".

The client code is hosted in Internet Explorer; the server code is
hosted in IIS, using the binary channel over HTTP.

The client is using the following config values:
<system.runtime.remoting>
<application>
<client url="http://localhost/MyVirtualDir/">
<activated type="My.Type, MyTypeLibrary"/>
</client>
<channels>
<channel ref="http">
<clientProviders>
<formatter ref="binary" />
</clientProviders>
</channel>
</channels>
</application>
</system.runtime.remoting>

The server web.config includes:
<system.runtime.remoting>
<application>
<service>
<activated type="My.Type, MyTypeLibrary"/>
</service>
<channels>
<channel ref="http">
<serverProviders>
<formatter ref="binary"/>
</serverProviders>
</channel>
</channels>
</application>
</system.runtime.remoting>

The MyTypeLibrary does exist in the web application's bin directory.

One other oddity is that the IE-hosted control is being served from a
different virtual directory. The file structure looks like this:
MyVirtualDir (virtual dir)
-> \bin
-> \bin\MyTypeLibrary.dll
-> \DownloadBin (virtual dir, from elsewhere in the filesystem)
-> \DownloadBin\MyControl.dll

The full stack trace (at the point where it leaves my code) is:

Server stack trace:
at
System.Runtime.Remoting.Activation.LocalActivator.GetMethodBase(IConstructionCallMessage
msg)
at
System.Runtime.Remoting.Activation.LocalActivator.Activate(IConstructionCallMessage
ctorMsg)
at
System.Runtime.Remoting.Activation.ActivationListener.Activate(IConstructionCallMessage
ctorMsg)
at
System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr
md, Object[] args, Object server, Int32 methodPtr, Boolean
fExecuteInContext, Object[]& outArgs)
at
System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(RuntimeMethodHandle
md, Object[] args, Object server, Int32 methodPtr, Boolean
fExecuteInContext, Object[]& outArgs)
at
System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage
msg, Int32 methodPtr, Boolean fExecuteInContext)

Exception rethrown at [0]:
at
System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
reqMsg, IMessage retMsg)
at
System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgData, Int32 type)
at
System.Runtime.Remoting.Activation.IActivator.Activate(IConstructionCallMessage
msg)
at
System.Runtime.Remoting.Activation.LocalActivator.DoRemoteActivation(IConstructionCallMessage
ctorMsg)
at
System.Runtime.Remoting.Activation.LocalActivator.Activate(IConstructionCallMessage
ctorMsg)
at
System.Runtime.Remoting.Activation.AppDomainLevelActivator.Activate(IConstructionCallMessage
ctorMsg)
at
System.Runtime.Remoting.Messaging.ClientContextTerminatorSink.SyncProcessMessage(IMessage
reqMsg)
at
System.Runtime.Remoting.Activation.ActivationServices.Activate(RemotingProxy
remProxy, IConstructionCallMessage ctorMsg)
at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(IMessage
reqMsg)
at
System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgData, Int32 type)
at My.Type..ctor(Boolean param)

There is no InnerException.

How should I go about debugging this? The site has FullTrust in the CAS
policy (I've already verified that). Why is it not finding the
constructor?
Re: Exception: The method '.ctor' was not found on the interface/type eric.means NO[at]SPAM gmail.com
7/3/2006 12:40:33 PM
[quoted text, click to view]

I figured out the problem.

Both the type being remoted, and the type calling it, are in the same
assembly. The type calling it was using a ctor marked "internal"
(rather than public), which obviously compiles just fine, but fails
when it's being called over Remoting (with the above mentioned
unhelpful error).

Changing the calling type to call a public ctor fixed the error.
AddThis Social Bookmark Button