none
Struggling to add Standard Discovery to existing working config file - Keep getting ArgumentnullException RRS feed

  • Question

  • I need help, thanks in advance.

    I have a config file that is using namedpipes as the communication model, my WCF solution runs on a client machine and is designed to support a 32bit legacy application being called from a 64bit VB Winform application. My last problem to solve was starting and stopping the server as needed, I decided to use Discovery/Announcement processing. Every time I add an variety of Discovery processing to my config file, my code immediately gets an ArgumentNullException in the open process

    _FileNetHost = New ServiceHost(GetType(FileNet))

    AddHandler _FileNetHost.Faulted, AddressOf FileNetHost_Faulted

    _FileNetHost.Open() <-- fails here

    I add the following based upon samples from MSDN, hoping to use a default implementation

    <endpoint isSystemEndpoint="true" kind="udpDiscoveryEndpoint" />

    which fails with

    System.InvalidOperationException occurred   HResult=-2146233079   Message=A ServiceDiscoveryBehavior is required to support the DiscoveryEndpoint 'CustomBinding_TargetService'. Add a ServiceDiscoveryBehavior via code or configuration file to make this service discoverable.   Source=System.ServiceModel.Discovery   StackTrace:        at System.ServiceModel.Discovery.DiscoveryEndpointValidator.System.ServiceModel.Description.IEndpointBehavior.ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)  InnerException:

    so I add the following

    <serviceDiscovery />

    and then I get

    System.ArgumentNullException occurred   HResult=-2147467261   Message=Value cannot be null. Parameter name: g   ParamName=g   Source=mscorlib   StackTrace:        at System.Guid..ctor(String g)   InnerException:

    The stack trace is

    mscorlib.dll!System.Guid.Guid(string g)Unknown System.ServiceModel.Internals.dll!System.Runtime.Fx.TryCreateGuid(string guidString, out System.Guid result)            Unknown System.ServiceModel.Discovery.dll!System.ServiceModel.Discovery.ScopeCompiler.TryGetUuidGuid(System.Uri scope, out System.Guid guid)          Unknown System.ServiceModel.Discovery.dll!System.ServiceModel.Discovery.ScopeCompiler.Compile(System.Uri scope, System.Collections.Generic.List<string> compiledScopes)          Unknown System.ServiceModel.Discovery.dll!System.ServiceModel.Discovery.ScopeCompiler.Compile(System.Collections.Generic.ICollection<System.Uri> scopes)           Unknown System.ServiceModel.Discovery.dll!System.ServiceModel.Discovery.EndpointDiscoveryMetadata.Open()Unknown System.ServiceModel.Discovery.dll!System.ServiceModel.Discovery.DiscoveryServiceExtension.PublishedEndpointCollection.InsertItem(int index, System.ServiceModel.Discovery.EndpointDiscoveryMetadata item)         Unknown The complete config I use is.

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <system.serviceModel>
     
        <behaviors>
          <serviceBehaviors>
            <behavior name="">
              <serviceMetadata />
              <serviceDebug includeExceptionDetailInFaults="true" />
              <serviceDiscovery />
            </behavior>
          </serviceBehaviors>
        </behaviors>
     
        <standardEndpoints>
          <udpDiscoveryEndpoint>
            <standardEndpoint multicastAddress="soap.udp://239.255.255.250:3702" />
          </udpDiscoveryEndpoint>
        </standardEndpoints >
     
        <services>
          <service name="UFCW.WCF.FileNet">
            <endpoint address="net.pipe://localhost/UFCWWCF/FileNetWCFService"
                binding="netNamedPipeBinding" bindingConfiguration="netNamedPipeBinding"
                name="FileNet" contract="UFCW.WCF.IFileNet" />
            <endpoint address="net.pipe://localhost/UFCWWCF/FileNetWCFService/mex"
                binding="mexNamedPipeBinding" contract="IMetadataExchange" />
            <endpoint isSystemEndpoint="true" kind="udpDiscoveryEndpoint" />
          </service>
        </services>
     
        <bindings>
          <netNamedPipeBinding>
            <binding name="netNamedPipeBinding" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="Infinite" sendTimeout="00:01:00" transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="5242880" maxBufferSize="655360" maxConnections="10" maxReceivedMessageSize="655360">
              <security mode="Transport">
                <transport protectionLevel="EncryptAndSign"/>
              </security>
            </binding>
          </netNamedPipeBinding>
          <mexNamedPipeBinding>
            <binding name="mexNamedPipeBinding"/>
          </mexNamedPipeBinding>
        </bindings>
     
      </system.serviceModel>
     
      <startup>
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
      </startup>
    </configuration>
    

    Friday, April 25, 2014 6:33 PM

All replies

  • The following configuration taken from MSDN can be applied to enable tracing on your WCF service.

    <configuration>
      <system.diagnostics>
        <sources>
          <source name="System.ServiceModel"
                  switchValue="Information, ActivityTracing"
                  propagateActivity="true" >
            <listeners>
                 <add name="xml"/>
            </listeners>
          </source>
          <source name="System.ServiceModel.MessageLogging">
            <listeners>
                <add name="xml"/>
            </listeners>
          </source>
          <source name="myUserTraceSource"
                  switchValue="Information, ActivityTracing">
            <listeners>
                <add name="xml"/>
            </listeners>
          </source>
        </sources>
        <sharedListeners>
            <add name="xml"
                 type="System.Diagnostics.XmlWriterTraceListener"
                 initializeData="Error.svclog" />
        </sharedListeners>
      </system.diagnostics>
    </configuration>

    To view the log file, you can use "C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\SvcTraceViewer.exe".

    Tuesday, April 29, 2014 9:45 AM
  • Another tidbit is I don't get the error when I remove the mex binding.

    Are MEX and Discovery allowed in a single WCF configuration ?

    Remember I'm using namedpipes.

    Tuesday, April 29, 2014 3:08 PM