Nevron Diagram
Skip Navigation Links
Home
Forum Home
Latest 50
Unanswered
Win Prizes
All Time Leaders
Jump to CategoryExpand Jump to Category
Login 
    Welcome Guest!
 Search Forum For :  
X
 Login
Please login to submit a new post, reply and edit exiting posts, see user profiles, and access more features. If you are not a registered member, Register here.
User Id / Email:
Password:  
Forgot Password | Forgot UserName
   Home » Remoting in VB.NET » Urgent help: the input stream is not a valid binary format, System.Runtime.Serialization.SerializationException
       
Author Reply
Melisa Ng
posted 1 posts
since Dec 11, 2008 
from Singapore

Urgent help: the input stream is not a valid binary format, System.Runtime.Serialization.SerializationException

  Posted on: 11 Dec 2008       

Our project uses the remoting as the distribution solution.

Client: Web Server (IIS 6)

Web Config is:

<system.runtime.remoting>

    <application>

      <channels>

        <channel ref="http">

          <clientProviders>

            <provider type="NCS.IConnect.ApplicationContexts.Remoting.Channels.ContextTransferClientSinkProvider, NCS.IConnect.ApplicationContexts"/>

            <formatter ref="binary"/>                              

                        </clientProviders>

        </channel>

      </channels>

    </application>

  </system.runtime.remoting>

Client source code like this:

Get object code via URL[RemotingProxyBase.cs]

    [EnvironmentPermission(SecurityAction.LinkDemand, Unrestricted=true)]

    protected virtual T GetObject(string url)

    {

        string proxyUrl = this.GetProxyUrl(url);

        return (T) Activator.GetObject(typeof(T), proxyUrl);

    }

 

    protected virtual string GetProxyUrl(string url)

    {

        return UrlHelper.GetRemotingUrl(url);

    }

 

Invoke the get method[CalculatorServiceProxy.cs]

…………………

 

        private const string RemoteUri = "http://localhost/RemotingServices/xxxx.rem";//It should be get from the config file, here is only for demo

 

        #region ICalculator Members

 

        public double Add(double x, double y)

        {

            return this.GetObject(RemoteUri).Add(x, y);

        }

 

        #endregion

    }

…………

Client code[Client.cs]

………………

CalculatorServiceProxy proxy = new CalculatorServiceProxy();

Console.WriteLine("x + y = {2} where x = {0} and y = {1}", 1, 2, proxy.Add(1, 2));

…………

Application Server:  IIS Host(Remoting)

  <system.runtime.remoting>

    <application>

      <channels>

        <channel ref="http">

          <serverProviders>

            <formatter ref="binary" />

            <provider type="xxxx.ApplicationContexts.Remoting.Channels.ContextTransferServerSinkProvider, xxxx.ApplicationContexts, Version=3.0.10919.0, Culture=neutral, PublicKeyToken=null" />

          </serverProviders>

        </channel>

      </channels>

      <service>

        <wellknown type="xxxx.CodeTableRemotingService,xxxx.CodeTable" objectUri="xxxx.rem" mode="SingleCall" />

      </service>

    </application>

  </system.runtime.remoting>

Service Source Code like this:

    public class CalculatorService:MarshalByRefObject, ICalculator

    {

        #region ICalculator Members

 

        public double Add(double x, double y)

        {           

            return x + y;

        }

 

        #endregion

    }

We have faced 2 critical  issue.

1)    When we test the remoting server via in the IE brower(http://localhost/RemotingServices/Calcualtor.rem?wsdl):

It always get the below exception(whether or not the server remoting use the binary or soap format):

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.Channels.Http.HttpHandlerTransportSink.HandleRequest(HttpContext context)
   at System.Runtime.Remoting.Channels.Http.HttpRemotingHandler.InternalProcessRequest(HttpContext context) 
 
When I run the client programme,
If the server use the soap format, it is working ok; if server use the binary format, it can’t working ok, and show the same exception with the above.

 

2)    In our production, our solution is the same architecture with the above description, It always throw the below exception in the web server log. We have tried a lot of time find the root cause, from some article, the means the remoting server occurs the exception and the web server can’t deserialize it into normal http

Format.

----------------------------------------

Timestamp: 29/11/2008 04:53 PM

Message:  System.Runtime.Serialization.SerializationException: The input stream is not a valid binary format. The starting contents (in bytes) are: 3C-3F-78-6D-6C-20-76-65-72-73-69-6F-6E-3D-22-31-2E ...

 

Server stack trace:

   at System.Runtime.Serialization.Formatters.Binary.SerializationHeaderRecord.Read(__BinaryParser input)

   at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadSerializationHeaderRecord()

   at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run()

   at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)

   at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)

   at System.Runtime.Remoting.Channels.CoreChannel.DeserializeBinaryResponseMessage(Stream inputStream, IMethodCallMessage reqMsg, Boolean bStrictBinding)

   at System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessage(IMessage msg)

 

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 NCS.IConnect.SessionManagement.ISessionRemotingService.RefreshUserSession(String userName, String sessionId, Int32 accountTimeOut)

   at NCS.IConnect.SessionManagement.RemotingSessionProvider.RefreshUserSession(String userName, String sessionId, Int32 accountTimeOut)

   at NCS.IConnect.SessionManagement.Web.SessionManager.RefreshCurrentUserSession()

   at NCS.Customs.Framework.WebUI.CustomsPageBase.OnInit(EventArgs e) in e:\eCustoms\Migration\MigrationBaseVersion_7687\WebUI\CustomsPageBase.cs:line 103

   at System.Web.UI.Control.InitRecursive(Control namingContainer)

   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Extended Properties: AuthenticationType - Forms IdentityName - 00268771 IsAuthenticated - True

Machine:  ECPDCWEB01

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Has anybody encountered the error? Is there any resolution to fix the issue?


Any help would be appreciated. Thanks in advance.
Melisa
       
Nevron Diagram
Dynamic PDF
ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
Introducing MaxV - one click. infinite control. Hyper-V Hosting from MaximumASP.
Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
Nevron Chart for .NET 2010.1 Now Available
The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
ASP.NET 4 Hosting
Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites - Click Here!
6 Months Free & No Setup Fees ASP.NET Hosting!
 Hosted by MaximumASP  |  Found a broken link?  |  Contact Us  |  Terms & conditions  |  Privacy Policy  |  Site Map  |  Advertise with us
Current Version: 5.2011.3.12
 © 1999 - 2012  Mindcracker LLC. All Rights Reserved