3

创建 WCF 配置文件时,我可能会在 Visual Studio 中收到此错误,因为 VS 编辑器不知道该扩展名。我需要知道将 transportClientEndpointBehavior 放在哪里,有什么帮助吗?谢谢。

 <behaviors>
  <endpointBehaviors>
    <behavior name="sharedSecretClientCredentials">
      <transportClientEndpointBehavior credentialType="SharedSecret">
        <clientCredentials>
          <sharedSecret issuerName="***********" issuerSecret="**********" />
        </clientCredentials>
      </transportClientEndpointBehavior>
      <ServiceRegistrySettings discoveryMode="Public"/>
    </behavior>
  </endpointBehaviors>
  ...
</behaviors>

我对 basicHttpRelayBinding 也有疑问,我认为它应该包含在绑定中。

4

3 回答 3

0

您是否安装了AppFabric SDKServiceRegistrySettings应该也是serviceRegistrySettings

于 2011-08-04T18:26:31.373 回答
0

Windows Azure 平台培训工具包中有一个以编程方式执行此操作的示例。这是示例片段...

// create the service URI based on the service namespace
        Uri address = ServiceBusEnvironment.CreateServiceUri("sb",
                      serviceNamespaceDomain, "EchoService");

        // create the credential object for the endpoint
        TransportClientEndpointBehavior sharedSecretServiceBusCredential = new TransportClientEndpointBehavior();
        sharedSecretServiceBusCredential.CredentialType = TransportClientCredentialType.SharedSecret;
        sharedSecretServiceBusCredential.Credentials.SharedSecret.IssuerName = issuerName;
        sharedSecretServiceBusCredential.Credentials.SharedSecret.IssuerSecret = issuerSecret;

        // create the service host reading the configuration
        ServiceHost host = new ServiceHost(typeof(EchoService), address);

        // create the ServiceRegistrySettings behavior for the endpoint
        IEndpointBehavior serviceRegistrySettings = new ServiceRegistrySettings(DiscoveryType.Public);

        // add the Service Bus credentials to all endpoints specified in configuration
        foreach (ServiceEndpoint endpoint in host.Description.Endpoints)
        {
            endpoint.Behaviors.Add(sharedSecretServiceBusCredential);
        }

        // open the service
        host.Open();
于 2011-03-01T23:31:03.723 回答
0

Visual Studio Intellisense 使用内置架构来执行验证。因此,它不会识别 transportClientEndpointBehavior 行为扩展,并会显示警告。忽略此警告。

答案来自微软官方教材“20487B-ENU-TrainerHandbook.pdf”。第 278 页

于 2016-05-09T10:03:51.263 回答