Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Remoting / July 2006

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
eric.means@gmail.com - 29 Jun 2006 16:25 GMT
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?
eric.means@gmail.com - 03 Jul 2006 20:40 GMT
> 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'.".

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.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.