WCF配置验证警告:'name'属性无效 - 值'<name>'根据其数据类型'serviceNameType'

时间:2018-02-13 03:07:06

标签: c# wcf

我一直在挖掘几个小时来解决这个问题,但还没有到任何地方。

我正在尝试配置服务并且所有内容都会编译,但是我收到一些警告,并且在尝试创建引用时找不到该服务。

具体信息是:

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

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

配置文件代码如下:

<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>

合同如下:

 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);

最后,服务类本身看起来像这样:

    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
    {

这不像我想的那样干净利落,但我希望这已经足够了。

我过去发现的所有内容都表明与界面或类名不匹配,但这些似乎都是正确的。我在这方面找不到任何正式的东西。有没有人有任何建议?

谢谢!

1 个答案:

答案 0 :(得分:0)

运行测试客户端提供了解决问题所需的信息。数据协定中的一个类包含多维数组。谢谢您的帮助!如果没有更详细的调试信息,我就无处可去。