Search code examples
c#wcf

WCF configuration validation warning: The 'name' attribute is invalid - The value '<NAME>' is invalid according to its datatype 'serviceNameType'


I have been digging for hours to solve this problem, but have not gotten anywhere.

I am attempting to configure a service and everything compiles, but I am getting some warnings and the service cannot be found when attempting to create a reference.

The specific messages are:

WCF configuration validation warning: The 'name' attribute is invalid - The value 'VisionProRegistrationService.VisionProRegistrationSvc' is invalid according to its datatype 'serviceNameType'.

and

WCF configuration validation warning: The 'contract' attribute is invalid - The value 'VisionProRegistrationService.IVisionProRegistrationSvc' is invalid according to its datatype 'serviceContractType'.

The config file code is as follows:

<system.serviceModel>
<services>
  <service behaviorConfiguration="VisionProRegistrationService.VisionProRegistrationServiceBehavior" name="VisionProRegistrationService.VisionProRegistrationSvc">
    <endpoint address="" binding="netTcpBinding" bindingConfiguration="" name="NetTcpBinding_IVisionProRegistrationService" contract="VisionProRegistrationService.IVisionProRegistrationSvc">
      <identity>
        <dns value="localhost"/>
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexTcpBinding" bindingConfiguration="" name="MexBinding_IVisionProRegistrationService" contract="IMetadataExchange"/>
    <host>
      <baseAddresses>
        <add baseAddress="net.tcp://localhost:8527/VisionProRegistrationService"/>
      </baseAddresses>
    </host>
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="VisionProRegistrationService.VisionProRegistrationServiceBehavior">
      <serviceMetadata httpGetEnabled="false" httpsGetEnabled="false"/>
      <serviceDebug includeExceptionDetailInFaults="true"/>
    </behavior>
    <behavior name="mexbehavior">
      <serviceMetadata/>
    </behavior>
  </serviceBehaviors>
</behaviors>

The contract looks like this:

 namespace VisionProRegistrationService {   [ServiceContract]   public interface IVisionProRegistrationSvc  {       [OperationContract]         bool Initialize(ServiceDataContracts.ModuleConfigurationData config, List<ServiceDataContracts.TcpClientData> clients,
                        string savedJobFilePath = null, string savedCalFilePath = null, int savedExposureTimeUs = 250, bool savedStrobePulseHi = true);

And finally, the service class itself looks like this:

    namespace VisionProRegistrationService
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in both code and config file together.
    public class VisionProRegistrationSvc : IVisionProRegistrationSvc
    {

This is not posting as cleanly as I would like, but I hope it is enough.

Everything I had found in the past indicated a mismatch with the interface or class name, but those all seem correct. I can't find anything officially on this. Does anyone have any suggestions?

Thanks!


Solution

  • Running the test client provided the information I needed to solve the problem. One of the classes in the data contract contained multidimensional arrays. Thanks for the help! I was not getting anywhere without the more detailed debugging information.