2011-03-01 84 views
3

創建WCF配置文件時,我可能會在Visual Studio中得到這個錯誤,因爲VS編輯器不知道該擴展。我需要知道在哪裏放置transportClientEndpointBehavior,有什麼幫助?謝謝。元素「行爲」具有無效子「transportClientEndpointBehavior」也basicHttpRelayBinding

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

我也有一個basicHttpRelayBinding的問題,我認爲它被包含在綁定下。

回答

0

在Windows Azure平臺培訓套件中有一個示例以編程方式執行此操作。這裏是示例snippit ...

// 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(); 
0

Visual Studio Intellisense使用內置模式來執行驗證。因此, 不會識別transportClientEndpointBehavior行爲擴展,並會顯示警告。 忽視此警告。

答案是從「20487B-ENU-TrainerHandbook.pdf」,這是微軟官方教材。 Page 278

+0

您不能忽視這一點。我遇到同樣的問題,因此無法啓動服務。因爲這是行爲的一個元素,所以行爲本身是無效的。因此,由於枚舉約束,使用該行爲的端點反過來是無效的。 – 2016-05-19 12:59:58

+0

我的答案來自微軟正式課本「20487B-ENU-TrainerHandbook.pdf」。頁面278 – ssinotna 2016-06-01 15:36:31

相關問題