मैं एक exe के अंदर से एक WCF सेवा चल रहा है (डिबगिंग के लिए, यह खिड़कियों सेवा जब तैनात में ले जाया जाएगा) मैं इसके बारे में अंदर ठीक चल रहा है एक सेवा मिल गया लेकिन विफल रहता है जब मैं दूसरी सेवा चलाता हूं तो मुझे अपवादWCF सेवा शुरू करने के लिए जब एक से अधिक सेवा उपलब्ध
System.InvalidOperationException was unhandled
Message=The ChannelDispatcher at 'http://backupsvr:8082/' with contract(s) '"IHttpGetHelpPageAndMetadataContract"' is unable to open its IChannelListener.
Source=System.ServiceModel
StackTrace:
at System.ServiceModel.Dispatcher.ChannelDispatcher.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open()
at Service.Program.Main() in E:\Visual Studio 2010\Projects\Contract Flow Suite\Service\Program.cs:line 30
InnerException: System.InvalidOperationException
Message=A registration already exists for URI 'http://backupsvr:8082/'.
Source=System.ServiceModel
StackTrace:
at System.ServiceModel.Channels.UriPrefixTable`1.RegisterUri(Uri uri, HostNameComparisonMode hostNameComparisonMode, TItem item)
at System.ServiceModel.Channels.HttpTransportManager.Register(TransportChannelListener channelListener)
at System.ServiceModel.Channels.TransportManager.Open(TransportChannelListener channelListener)
at System.ServiceModel.Channels.TransportManagerContainer.Open(SelectTransportManagersCallback selectTransportManagerCallback)
at System.ServiceModel.Channels.TransportChannelListener.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.HttpChannelListener.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Dispatcher.ChannelDispatcher.OnOpen(TimeSpan timeout)
InnerException:
यहां कोड है जो इसे कॉल करता है।
using(ServiceHost hostRemoteUserManager = new ServiceHost(typeof(RemoteUserManager)))
using(ServiceHost hostDatabaseManagement = new ServiceHost(typeof(DatabaseManagement)))
try
{
// Open the ServiceHost to start listening for messages.
hostRemoteUserManager.Open();
hostDatabaseManagement.Open(); //Exception on this line.
// The service can now be accessed.
Console.WriteLine("The service is ready.");
Console.WriteLine("Press <ENTER> to terminate service.");
Console.ReadLine();
// Close the ServiceHost.
hostRemoteUserManager.Close();
hostDatabaseManagement.Close();
}
और यहां मेरी App.config फ़ाइल है, मैंने इसे बनाने के लिए विजुअल स्टूडियो 2010 में सेवा कॉन्फ़िगरेशन संपादक का उपयोग किया था।
REMOVED
क्या कर मैं अपने App.config फ़ाइल उन्हें विभिन्न बंदरगाहों पर चलाने की तुलना में एक से अधिक सेवा अन्य अनुमति देने के लिए बदलने की जरूरत है। मैं http://backupsvr:8082/ से पूछताछ करना चाहता हूं और जब मैं "सेवा जोड़ें" उपकरण का उपयोग करता हूं तो यह सभी सेवाओं को सूचीबद्ध करता है।
अद्यतन -
मैं इगोर के सुझाव इसे अभी जोड़ें सेवा refrence संवाद मैं अभी भी और http://backupsvr:8082/RemoteUserManager में टाइप करने की आवश्यकता http://backupsvr:8082/DatabaseManagement सिर्फ एक http://backupsvr:8082/ के insted में हालांकि एक ही बंदरगाह पर चलता किया। मुझे नहीं पता कि मैं जो चाहता हूं वह संभव है, ऐसा लगता है कि जिस तरह से संवाद को डिजाइन किया गया है, वैसे ही यह होना चाहिए। यहां दूसरी सेवा के लिए पहली सर्विस के लिए फ़ाइल मेरी app.config का एक अद्यतन प्रतिलिपि
<?xml version="1.0"?>
<configuration>
<system.diagnostics>
<sources>
<source propagateActivity="true" name="System.ServiceModel" switchValue="Off,ActivityTracing">
<listeners>
<add type="System.Diagnostics.DefaultTraceListener" name="Default">
<filter type="" />
</add>
</listeners>
</source>
<source name="System.ServiceModel.MessageLogging" switchValue="Warning, ActivityTracing">
<listeners>
<add type="System.Diagnostics.DefaultTraceListener" name="Default">
<filter type="" />
</add>
</listeners>
</source>
</sources>
</system.diagnostics>
<system.serviceModel>
<bindings>
<mexHttpBinding>
<binding name="MexBinding" />
</mexHttpBinding>
</bindings>
<diagnostics>
<messageLogging logMalformedMessages="false" logMessagesAtServiceLevel="false"
logMessagesAtTransportLevel="false" />
</diagnostics>
<behaviors>
<serviceBehaviors>
<behavior name="RemoteUserManagerBehavior">
<serviceMetadata httpGetEnabled="true" />
</behavior>
<behavior name="DatabaseManagementBehavior">
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="RemoteUserManagerBehavior" name="Service.RemoteUserManager">
<endpoint address="" binding="netTcpBinding"
bindingConfiguration="" name="RemoteUserManagerBinding" contract="Service.IRemoteUserManager" />
<endpoint address="mex" binding="mexHttpBinding"
bindingConfiguration="MexBinding" name="RemoteUserManagerMetadata"
contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://backupsvr:8082/RemoteUserManager" />
<add baseAddress="net.tcp://backupsvr:8081/RemoteUserManager" />
</baseAddresses>
</host>
</service>
<service behaviorConfiguration="DatabaseManagementBehavior" name="Service.DatabaseManagement">
<endpoint address="" binding="netTcpBinding"
bindingConfiguration="" name="DatabaseManagementBinding" contract="Service.IDatabaseManagement" />
<endpoint address="mex" binding="mexHttpBinding"
bindingConfiguration="MexBinding" name="DatabaseManagementMetaData"
contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://backupsvr:8082/DatabaseManagement" />
<add baseAddress="net.tcp://backupsvr:8081/DatabaseManagement" />
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
<startup><supportedRuntime version="v2.0.50727"/></startup></configuration>
उपयोग एक अलग होना चाहिए हर सेवा के लिए baseaddress <जोड़ने baseAddress = "http: // backupsvr: 8082 /" /> और दूसरे <जोड़ने baseAddress = "http: // backupsvr: 8081 /" /> 0,123, यह है करने के लिए (कई अंतिमबिंदुओं लेकिन एक सेवा लागू करने के लिए एक बंदरगाह) एक बंदरगाह पर एक सेवा – garik
@Igor की तुलना में अधिक है, तो आप "उपलब्ध सेवाओं" जब आप की एक सूची से क्लिक करते हैं तो आप केवल एक सेवा कर सकते हैं, तो क्यों असंभव है सेवा संदर्भ जोड़ने का उपयोग करें? –
वह त्रुटि है, यह काम करता है जकड़ना करने के लिए जब आप 2 ओपन() कहता है, या जब आप केवल 2 चलाने का क्रम बदलने? –