Invalid Binary Format

I so much need your help here.

I have a simple application ... and its going to get big :) if I figure out the .NET remoting part.
It just wont work.

Its based on configuration files. I use VS 2005 - .NET 2.0 - IIS 6.0 to host the remoting objects and a simple Form GUI to test. I use binary format.

thats the code :

web.config - server :

<system.runtime.remoting>
    <application>
      <service>
        <wellknown mode="SingleCall" objectUri="Mail.rem" type="RemotingServer.MailManager, RemotingServer" />
      </service>
      <channels>
        <channel ref="http">
          <serverProviders>
            <formatter ref="binary" typeFilterLevel="Full" />
          </serverProviders>
        </channel>               
      </channels>
    </application>
  </system.runtime.remoting>


client - app.config

<system.runtime.remoting>
    <application name="clientUI">
      <client url="http://xxxxxxxx:8000/RemoteIIS/Mail.rem" type="RemotingServer.MailManager, RemotingServer">
      </client>
      <channels>
        <channel ref="http">
          <clientProviders>
            <formatter ref="binary"/>
          </clientProviders>
          <serverProviders>
            <formatter ref="binary" typeFilterLevel="Full"/>
          </serverProviders>
        </channel>
      </channels>
    </application>


and thats is the code of my client (an onlick handler) :

Try

Dim configFilePath As String = System.IO.Path.Combine(System.Environment.CurrentDirectory, "ClientUI.exe.config")

RemotingConfiguration.Configure(configFilePath, False)
       
'1.
'Dim service As RemotingServer.Mailmanager = New RemotingServer.Mailmanager()

'2.
'Dim service As RemotingServer.Mailmanager = CType(Activator.GetObject(GetType(RemotingServer.Mailmanager), "http://pdsintranet:8000/RemoteIIS/Mail.rem"), RemotingServer.Mailmanager)

'3.
Dim o As Object = RemotingServices.Connect(GetType(RemotingServer.Mailmanager), "http://pdsintranet:8000/RemoteIIS/Mail.rem")
Dim service As RemotingServer.Mailmanager = CType(o, RemotingServer.Mailmanager)

Debug.Print(RemotingServices.IsTransparentProxy(service))
Debug.Print(service.getCompName())

'Me.Mail1.Merge(service.GetEmails())

Catch eX As Exception

Debug.Write(eX.StackTrace())

End Try



if i try to get the Mailmanager object by the 1st way : i get the local copy!!!
with the 2nd and 3rd ways i get the following error :

System.Runtime.Serialization.SerializationException: The input stream is not a valid binary format. The starting contents (in bytes) are: 53-79-73-74-.....

I would really appreciate your help.

Thanks in advance


Answer this question

Invalid Binary Format

  • Ntompson

    I am getting the same error. My client config looks exactly as yours does, but I still get the error. Anything else I need to do
  • alypeely

    Did that work for you If not please, it would be great if you could provide us more of the exception bytes.

  • Chris Anderson

    Well check what I ve done so far...

     

    this is part of the server web.config

    <system.runtime.remoting>
      <application>
       <channels>
        <channel ref="http" priority="100">
         <formatter ref="binary"/>
        </channel>
       </channels>
       <service>
        <wellknown mode="Singleton" objectUri="CustomerFacade.rem" type="ComasFacade.CustomerFacade , ComasFacade"/>
       </service>
       <service>
        <wellknown mode="Singleton" objectUri="UserFacade.rem" type="ComasFacade.UserFacade, ComasFacade"/>
       </service>
       <service>
        <wellknown mode="Singleton" objectUri="GeneralFacade.rem" type="ComasFacade.GeneralFacade, ComasFacade"/>
       </service>
      </application>
     </system.runtime.remoting>

     

    This is part of the client app.config

     

     <system.runtime.remoting>
          <application>
            <channels>
              <channel ref="http" useDefaultCredentials="true" useAuthenticatedConnectionSharing="true">
                <clientProviders>
                  <formatter ref="binary" />
                </clientProviders>
              </channel>
            </channels>
          </application>
      </system.runtime.remoting>

    and this is part of the client code

    Dim cFacade As ComasFacade.I_CustomerFacade = CType(Activator.GetObject(GetType(ComasFacade.I_CustomerFacade), "http://xxxxx:xxxx/RemoteIIS/CustomerFacade.rem"), ComasFacade.I_CustomerFacade)

    where I_CustomerFacade is the interface implemented. So that the client needs to know the interface only and not the actual class.

    By the way you can see I dont use wellknown types in my client config.

     

    I hope it helps.


  • Martin Hart Turner

    Hi stratos

    Try this on client (It's works for me just fine) : 

    -<configuration>
    - <system.runtime.remoting>
    - <application>
    - <channels>
    - <channel ref="http">
    - <clientProviders>
      <formatter ref="binary" />
      </clientProviders>
      </channel>
      </channels>
    - <client>
      <wellknown type="RemotingServer.MailManager,RemotingServer" url="http://xxx.xxx.xxx.xxx:8000/RemoteIIS/Mail.rem" />
      </client>
      </application>
      </system.runtime.remoting>
      </configuration>


     


  • Ray Myers

    Exactly! Great. Thank you for your help.


  • DarkCat

    hi ,

    you get this message because you have an error in your server side application.

    iis reports errors as text message thus your client can not parse it. ( because of binary formatter)

    change the formatter from binary to soap in client config file like this :

    <clientProviders>
    <formatter ref="soap"/>
    </clientProviders>

    now you will get correct error message .and try to correct it.

    Aidin.T



  • Invalid Binary Format