HELP! with Remoting

Posts   
 
    
Angus
User
Posts: 44
Joined: 08-Jul-2005
# Posted on: 23-Apr-2008 22:57:38   

I am under the gun here trying to move a system into production and have been getting errors with binary formating using IIS.

I put together a test site that uses IIS and the binary formatter and everything worked great. I was able to pass entity, typedList and generic collections back and forth from the remote server with no problem.

Now I have created a new site for production (really just another virtual directory on the same IIS server) and I am getting serialization errors.

Here are my configurations

On my test / dev site I have the web.config file looking like this (everything WORKS)


<system.runtime.remoting>
      <application>
         <service>
            <wellknown mode="Singleton" type="Server.clsServer,Server" objectUri="server.rem" /> 
         </service>
         <channels>
            <channel ref="http">
               <serverProviders>
                  <provider ref="wsdl"/>
                  <formatter ref="binary" typeFilterLevel="Full"/>
               </serverProviders>
               <clientProviders>
                  <formatter ref="binary"/>
               </clientProviders>
            </channel>
         </channels>
      </application>
   </system.runtime.remoting>

on the production site I have the web.config file looking like this. (Getting errors)


   <system.runtime.remoting>
      <application>
         <service>
            <wellknown mode="Singleton" type="PVSCRemoteServer.ClinicManager,PVSCRemoteServer" objectUri="PvscClinicManager.rem" /> 
            <wellknown mode="Singleton" type="PVSCRemoteServer.UserManager,PVSCRemoteServer" objectUri="PvscUserManager.rem" /> 
         </service>
         <channels>
            <channel ref="http">
               <serverProviders>
                  <provider ref="wsdl"/>
                        <formatter ref="binary" typeFilterLevel="Full"/>
               </serverProviders>
               <clientProviders>
                  <formatter ref="binary"/>
               </clientProviders>
            </channel>
         </channels>
      </application>
   </system.runtime.remoting>

Here is the Error I'm getting

"No message was deserialized prior to calling the DispatchChannelSink."


      System.Runtime.Remoting.RemotingException was caught
        Message="System.ArgumentNullException: No message was deserialized prior to calling the DispatchChannelSink.
      Parameter name: requestMsg
         at System.Runtime.Remoting.Channels.DispatchChannelSink.ProcessMessage(IServerChannelSinkStack sinkStack, IMessage requestMsg, ITransportHeaders requestHeaders, Stream requestStream, IMessage& responseMsg, ITransportHeaders& responseHeaders, Stream& responseStream)
         at System.Runtime.Remoting.Channels.BinaryServerFormatterSink.ProcessMessage(IServerChannelSinkStack sinkStack, IMessage requestMsg, ITransportHeaders requestHeaders, Stream requestStream, IMessage& responseMsg, ITransportHeaders& responseHeaders, Stream& responseStream)
         at System.Runtime.Remoting.MetadataServices.SdlChannelSink.ProcessMessage(IServerChannelSinkStack sinkStack, IMessage requestMsg, ITransportHeaders requestHeaders, Stream requestStream, IMessage& responseMsg, ITransportHeaders& responseHeaders, Stream& responseStream)
         at System.Runtime.Remoting.Channels.Http.HttpHandlerTransportSink.HandleRequest(HttpContext context)
         at System.Runtime.Remoting.Channels.Http.HttpRemotingHandler.InternalProcessRequest(HttpContext context)
      "

I can get this error to go away if I add soap formatting with the following line to the web.config file


 <formatter ref="soap" typeFilterLevel="Full" />    

So now the web.config file looks like this

   <system.runtime.remoting>
      <application>
         <service>
            <wellknown mode="Singleton" type="PVSCRemoteServer.ClinicManager,PVSCRemoteServer" objectUri="PvscClinicManager.rem" /> 
            <wellknown mode="Singleton" type="PVSCRemoteServer.UserManager,PVSCRemoteServer" objectUri="PvscUserManager.rem" /> 
         </service>
         <channels>
            <channel ref="http">
               <serverProviders>
                  <provider ref="wsdl"/>
                        <formatter ref="binary" typeFilterLevel="Full"/>
                        <formatter ref="soap" typeFilterLevel="Full" /> 
               </serverProviders>
               <clientProviders>
                  <formatter ref="binary"/>
               </clientProviders>
            </channel>
         </channels>
      </application>
   </system.runtime.remoting>

The big problem here is NOW I can not send Generic Collections back because soap does not allow this. Plus it is slower by using soap and not binary.

Please help!

Thanks so much.

Angus
User
Posts: 44
Joined: 08-Jul-2005
# Posted on: 24-Apr-2008 03:24:33   

OK I realized what I had done (STUPID) and wanted to post the solution in case anyone else stumbles across this issue.

I was neglecting to read the config file on the client (even though I had update the config file)

here is the code for that.


      Dim fileName As String = "ApplicationName.exe.config"
       System.Runtime.Remoting.RemotingConfiguration.Configure(fileName)

As I don't like hard coded strings in my apps, I also did this programatically



      Dim ServiceChannel As IChannel
      Dim serverProv As BinaryServerFormatterSinkProvider = New BinaryServerFormatterSinkProvider
      Dim clientProv As BinaryClientFormatterSinkProvider = New BinaryClientFormatterSinkProvider
      Dim Props As IDictionary = New Hashtable
      serverProv.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full
      ServiceChannel = New Http.HttpChannel(Props, clientProv, serverProv)
      ChannelServices.RegisterChannel(ServiceChannel, False)

Hope this helps others.

Chris