2009-03-04 9 views
0

設定ファイルを扱うのはうんざりですので、WCFサービスをコードでのみ設定しようとしています。私はIMetadataExchangeをコメントアウト場合、これは動作します設定ファイルのないWCFサーバー

m_ServiceHost = New ServiceHost(Me) 
    m_ServiceHost.AddServiceEndpoint( 
      GetType(Aam.AamServiceFramework.IServiceMonitor), 
      New NetTcpBinding, "net.tcp://localhost:6000) 
    m_ServiceHost.AddServiceEndpoint(
      GetType(IMetadataExchange), 
      New NetTcpBinding, "net.tcp://localhost:6500) 
    m_ServiceHost.Open() 

これまでのところ、私はこれを持っています。どのように私はその作品を扱うのですか?

答えて

4
m_ServiceHost.Description.Behaviors.Add(New ServiceMetadataBehavior()) 
    m_ServiceHost.AddServiceEndpoint(
      GetType(IMetadataExchange), 
      MetadataExchangeBindings.CreateMexTcpBinding(), 
      "net.tcp://localhost:6595")