开发者

WCF - How can i make this config cleaner

开发者 https://www.devze.com 2023-01-07 04:47 出处:网络
I am new to WCF ,i have this config file and i really want to make it cleaner. <?xml version=\"1.0\" encoding=\"utf-8\"?>

I am new to WCF ,i have this config file and i really want to make it cleaner.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.serviceModel>
    <services>
      <service behaviorConfiguration="warConfig" name="Service.WarService">
        <host>
          <baseAddresses>
            <add baseAddress="net.tcp://localhost:2222/war"/>
          </baseAddresses>
        </host>
        <endpoint address="" binding="netTcpBinding" contract="Service.IWarService"/>
        <endpoint address="MEX" binding="mexTcpBinding" contract="IMetadataExchange" />
      </service>
      <service behaviorConfiguration="authConfig" name="Service.AuthService">
        <host>
          <baseAddresses>
            <add baseAddress="net.tcp://localhost:2222/auth"/>
          </baseAddresses>
        </host>
        <endpoint address="" binding="netTcpBinding" contract="Service.IAuthService"/>
        <endpoint address="MEX" binding="mexTcpBinding" contract="IMetadataExchange" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="warConfig">
          <serviceMetadata />
        </behavior>
        <behavior name="authConfig">
          <serviceMetadata />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
  <connectionStrings>
    <add name="WarDatabaseEntities" connectionString="metadata=res://*/WarModel.csdl|res://*/WarModel.ssdl|res://*/WarModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=BOGUS\SQLEXPRESS;Initial Catalog=WarDatabase;Integrated Security=True;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>
</configuration>

1) I am trying to get rid of those base addresses but when i run it i get this exception

Could not find a base address that matches scheme net.tcp for the endpoint with binding NetTcpBinding. Registered base address schemes are [].

2)If i use svcutil.exe for both services i get some duplicate classes in the client services:

public partial class ObjectChangeTracker : object, System.Runtime.Serialization.IExtensibleDataObject
public class ExtendedPropertiesDictionary : System.Collections.Generic.Dictionary<string, object>
public class ObjectsAddedToCollectionProperties : System.Collections.Generic.Dictionary<string, Service.ObjectList>
public class ObjectsRemovedFromCollectionProperties : System.Collections.Generic.Dictionary<string, Service.ObjectList>
public class OriginalValuesDictionary : System.Collections.Generic.Dictionary<string, object>
public enum ObjectState : int
public class ObjectList : System.Collections.Gen开发者_运维百科eric.List<object>


Don't worry about the cleanliness of the configuration. It's a lot like sausage - you don't want to know the details.

0

精彩评论

暂无评论...
验证码 换一张
取 消