none
In WCF CreateServiceHost method is throwing the ArgumentNullException because of baseAddresses is coming as NULL RRS feed

  • Question

  • Hi,

    In the CreateServiceHost(string constructorString, Uri[] baseAddresses) method, baseAddresses is coming NULL and it is throwing the below exception,

    Exception Details: System.ArgumentNullException: Value cannot be null.
    Parameter name: addresses
       at System.ServiceModel.UriSchemeKeyedCollection..ctor(Uri[] addresses)
       at System.ServiceModel.ServiceHost..ctor(Type serviceType, Uri[] baseAddresses)
       at System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(Type serviceType, Uri[] baseAddresses)
       at System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses)
       at BackupSln.Silverlight.Web.SilverlightServiceFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses) )
    ( Exception logged from:
       at Altiris.Diagnostics.Logging.EventLog.ReportException(Int32 severity, String strMessage, String category, Exception exception)
       at Altiris.NS.Logging.EventLog.ReportException(Int32 severity, String strMessage, String category, Exception exception)
       at BackupSln.Silverlight.Web.SilverlightServiceFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses)
       at System.ServiceModel.ServiceHostingEnvironment.HostingManager.CreateService(String normalizedVirtualPath)
       at System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService(String normalizedVirtualPath)
       at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)
       at System.ServiceModel.ServiceHostingEnvironment.EnsureServiceAvailableFast(String relativeVirtualPath)
       at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest()
       at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest()
       at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequest(Object state)
       at System.ServiceModel.PartialTrustHelpers.PartialTrustInvoke(ContextCallback callback, Object state)
       at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequestWithFlow(Object state)
       at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.WorkItem.Invoke2()
       at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.WorkItem.Invoke()
       at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.ProcessCallbacks()
       at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.CompletionCallback(Object state)
       at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.ScheduledOverlapped.IOCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
       at System.ServiceModel.Diagnostics.Utility.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped)
       at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
     )
    ( Extra Details:  Type=System.ArgumentNullException Src=System.ServiceModel )

    The WCF hosted system is in domain and we are using this WCF service for Silverlight application. The environment details are below,

    Operating System : Windows 2008 R2 64 bit

    IIS : 7.5

    Silverlight Tools : 3.0 SDK

    .Net Framework : 3.5

    Kindly require your help in solving this problem.

    Tuesday, June 25, 2013 6:50 AM

Answers

All replies

  • See!

    The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

    The problem is caused by IIS handling of multiple host headers. Like blowdart said here. error: This collection already contains an address with scheme http.

    and somewhat more elaborate here http://forums.silverlight.net/forums/p/12883/274592.aspx

    It seems my problem is somewhat more complex due to the https binding, this is the ServiceHostFactory I came up with:


    Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.

    Tuesday, June 25, 2013 7:37 AM
  • The multiple host headers problem we have already handled. This issue is coming before it, if we get the baseAddresses then we will find the multiple hosts are present or not, here the problem is baseAddresses itself coming as NULL, without the baseAddresses data how do we continue further ?

    Tuesday, June 25, 2013 9:51 AM
  • Hi,

    I hope the issue is solved, if not, what is the issue now? And can you please give more information on how you get this issue?

    Best Regards.


    Haixia
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, June 26, 2013 9:58 AM
    Moderator
  • The issue is not resolved. The issue is, we are overriding the method CreateServiceHost(string constructorString, Uri[] baseAddresses)  to create the service host, the parameter baseAddresses is coming NULL for us. We don't know in what scenario the NULL is coming. We already have the logic to solve the Multiple host headers problem if we get the value in baseAddresses. But, the problem here is baseAddresses is coming as NULL. 
    Wednesday, June 26, 2013 10:54 AM
  • Hi,

    Do you have some breakpoints to check when baseAddresses become null?

    In addition, you may check a sample in MSDN at http://msdn.microsoft.com/en-us/library/aa395224.aspx ,which demonstrates how to use a custom derivative of the ServiceHost class to alter the run-time behavior of a service and provides a complete sample codes.

    Best Regards.


    Haixia
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, June 27, 2013 4:44 AM
    Moderator