Note that there are some explanatory texts on larger screens.

plurals
  1. POCannot connect to a WCF service hosted in a Worker Role
    primarykey
    data
    text
    <p>I've created a WCF service and hosted it in cloud through a worker role. Unfortunately when I try to connect to the worker role service I get an exception with the message: "No DNS entries exist for host 3a5c0cdffcf04d069dbced5e590bca70.cloudapp.net." 3a5c0cdffcf04d069dbced5e590bca70.cloudapp.net is the address for the worker role deployed in azure staging environment. The workerrole.cs has the following code to expose the WCF service:</p> <pre><code> public override void Run() { using (ServiceHost host = new ServiceHost(typeof(MyService))) { string ip = RoleEnvironment.CurrentRoleInstance.InstanceEndpoints["tcppoint"].IPEndpoint.Address.ToString(); int tcpport = RoleEnvironment.CurrentRoleInstance.InstanceEndpoints["tcppoint"].IPEndpoint.Port; int mexport = RoleEnvironment.CurrentRoleInstance.InstanceEndpoints["mexinput"].IPEndpoint.Port; // Add a metadatabehavior for client proxy generation // The metadata is exposed via net.tcp ServiceMetadataBehavior metadatabehavior = new ServiceMetadataBehavior(); host.Description.Behaviors.Add(metadatabehavior); Binding mexBinding = MetadataExchangeBindings.CreateMexTcpBinding(); string mexlistenurl = string.Format("net.tcp://{0}:{1}/MyServiceMetaDataEndpoint", ip, mexport); string mexendpointurl = string.Format("net.tcp://{0}:{1}/MyServiceMetaDataEndpoint", RoleEnvironment.GetConfigurationSettingValue("Domain"), 8001); host.AddServiceEndpoint(typeof(IMetadataExchange), mexBinding, mexendpointurl, new Uri(mexlistenurl)); // Add the endpoint for MyService string listenurl = string.Format("net.tcp://{0}:{1}/MyServiceEndpoint", ip, tcpport); string endpointurl = string.Format("net.tcp://{0}:{1}/MyServiceEndpoint", RoleEnvironment.GetConfigurationSettingValue("Domain"), 9001); host.AddServiceEndpoint(typeof(IMyService), new NetTcpBinding(SecurityMode.None), endpointurl, new Uri(listenurl)); host.Open(); while (true) { Thread.Sleep(100000); Trace.WriteLine("Working", "Information"); } } } </code></pre> <p>The tcppoint and mexinput are configured with the ports 8001 and 9001. Also Domain is configured with worker role deployment url:3a5c0cdffcf04d069dbced5e590bca70.cloudapp.net</p> <p>On the client part(a console app), we are using the following configuration in app.config::</p> <p> </p> <pre><code> &lt;bindings&gt; &lt;netTcpBinding&gt; &lt;binding name="NetTcpBinding_IMyService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" listenBacklog="10" maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10" maxReceivedMessageSize="65536"&gt; &lt;readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" /&gt; &lt;reliableSession ordered="true" inactivityTimeout="00:50:00" enabled="false" /&gt; &lt;security mode="None"&gt; &lt;transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" /&gt; &lt;message clientCredentialType="Windows" /&gt; &lt;/security&gt; &lt;/binding&gt; &lt;/netTcpBinding&gt; &lt;/bindings&gt; &lt;client&gt; &lt;endpoint address="httpp:\\3a5c0cdffcf04d069dbced5e590bca70.cloudapp.net:9001/MyServiceEndpoint" binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IMyService" contract="ServiceReference1.IMyService" name="NetTcpBinding_IMyService" /&gt; &lt;/client&gt; &lt;behaviors&gt; &lt;serviceBehaviors&gt; &lt;behavior name="behave"&gt; &lt;serviceMetadata httpGetEnabled="false"/&gt; &lt;/behavior&gt; &lt;/serviceBehaviors&gt; &lt;/behaviors&gt; &lt;/system.serviceModel&gt; &lt;system.net&gt; &lt;defaultProxy useDefaultCredentials="true"&gt; &lt;proxy autoDetect="False" usesystemdefault="False" bypassonlocal="True" /&gt; &lt;/defaultProxy&gt; </code></pre> <p> </p> <p>The following code is built using the sample code available in msdn as background. Locally it is working fine. Unfortunately when i deploy it to cloud, the exception occurs. Moreover, when i use the virtual ip instead of the url, a connection time out occurs with the exception the remote machine did not respond.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload