"No Endpoint Listening” in WCF Service Hosted in external Windows Service - wcf

I'm working on some code refactoring within an existing application.
The application is already hosted and it works fine.
I have WCF services hosted by an external Windows service.
Indeed, I'm working locally and I'm trying to test some code implementations in the Pre prod environment.
So, this is the proxy configuration within the basicHttpBinding code:
<bindings>
<basicHttpBinding>
<!--proxy configuration must be provided-->
<binding name="BindingTimeSheet" maxReceivedMessageSize="6000000" useDefaultWebProxy="false" proxyAddress="http://xxx.xxx.x.x:xxxx" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:01:00" sendTimeout="00:01:00">
<readerQuotas />
<security mode="Transport">
<transport clientCredentialType="Ntlm" />
</security>
</binding>
</basicHttpBinding>
</bindings>
and this is project server endpoint configuration:
<client>
<endpoint address="https://xxxxxxxxxx.asmx" binding="basicHttpBinding" bindingConfiguration="BindingTimeSheet" contract="ProxyClientJeanDoe.JeanDoeSoap" name="JeanDoeSoap" />
</client>
I'm receiving this exceptions:
Inner Exception 1: EndpointNotFoundException: There was no listening
endpoint on https://xxxxxxx.asmx that could accept the message. This
is often due to an incorrect address or SOAP action. If present, see
the InnerException element for more information.
Inner Exception 2: WebException: Can not connect to remote server
Inner Exception 3: SocketException: A connection attempt failed
because the connected party did not respond properly after a certain
amount of time or an established connection failed because the login
host did not respond xxx.xxx.xx.x:xxxx
I have tested the WSDL services and they are working fine but the proxy address is not responding
I have already tried to set the anonymous authentication enabled and I'm working in a local machine where the Internet connection is using a proxy server and it's impossible to configure the firewall for Security reasons.
thanks for your understanding

Finally, The problem was related with the BypassProxyOnLocal flag.
It was enabled so the requests to local Internet resources was not using the proxy server.
This configuration placed into the Web.config works fine.
<system.net>
<defaultProxy useDefaultCredentials="true">
<proxy usesystemdefault="True" proxyaddress="http://xxxxxxxxxxx:8080"
bypassonlocal="False"/>
</defaultProxy>
</system.net>
Thank you.

Related

Remote computer is not available when trying to pull from remote private queue

I have a remote private queue that I can write to without issue. I am trying to create a WAS-hosted WCF service to pull the data for processing. I need the service to be on a different machine than the queue; I currently have it in the same site as the writing service - same app pool but a different application.
The queue I am targetting is called PersistenceService/Log.svc and is transactional and authenticated. My service is running at http://appdev.me.com/PersistenceService/Log.svc. The below contains my endpoint and binding:
<bindings>
<msmqIntegrationBinding>
<binding exactlyOnce="true" durable="true" serializationFormat="Xml" maxReceivedMessageSize="2147483647"
closeTimeout="00:00:30" sendTimeout="00:00:30" receiveTimeout="00:00:30" timeToLive="24:00:00"
receiveRetryCount="1" maxRetryCycles="1" retryCycleDelay="00:10:00" receiveErrorHandling="Move">
<security mode="Transport" />
</binding>
</msmqIntegrationBinding>
</bindings>
<services>
<service name="Me.Logging.Persistence.PersistenceService">
<endpoint address="msmq.formatname:DIRECT=OS:DIRECT=OS:meserver\private$\persistenceservice/log.svc"
binding="msmqIntegrationBinding"
bindingNamespace="http://me.logging/services/2012/11"
contract="Me.Logging.Service.Shared.Service.Contracts.ICatchAll" />
</service>
</services>
The error that I get is the below:
An error occurred while opening the queue:The remote computer is not available. (-1072824215, 0xc00e0069). The message cannot be sent or received from the queue. Ensure that MSMQ is installed and running. Also ensure that the queue is available to open with the required access mode and authorization.
I have cleared the way for communications by shutting down McAfee so it's not blocking traffic. I have granted ANONYMOUS LOGON access to the queue temporarily - though it should be coming in as the same user through which I'm writing to the queue, and that user has full rights on the queue.
The WCF trace doesn't reveal anything other than this error. Any ideas as to where to look would be greatly appreciated.
Your endpoint looks to be incorrect. You have "DIRECT=OS:" in there twice. Try:
<endpoint address="msmq.formatname:DIRECT=OS:meserver\private$\persistenceservice/log.svc"
binding="msmqIntegrationBinding"
bindingNamespace="http://me.logging/services/2012/11"
contract="Me.Logging.Service.Shared.Service.Contracts.ICatchAll" />

disable web proxy for a WCF client?

My computer have a proxy server defined globally (in internet options configuration).
I have a .Net 4 application that use a WCF client to a remote host. The client code has been generated by VS add service reference dialog. As my proxy can't reach the host, each call ends with a communication exception.
How can I set up my client configuration to not use the default proxy ?
You can tell WCF not to use the default proxy by setting the BasicHttpBinding.UseDefaultWebProxy to false:
<client>
<endpoint address="http://server/myservice"
binding="basicHttpBinding"
contract="IMyService" />
</client>
<bindings>
<basicHttpBinding>
<binding useDefaultWebProxy="false" />
</basicHttpBinding>
</bindings>
In your Binding configuration, set useDefaultWebProxy=false

WCF Service call working with basicHttpBinding but fails with netTcpBinding

(Please read comment as i have a fix)
Hi,
I have created a WCF Service that i am hosting in IIS 7.5 on Windows 7 using .net 4.0
The service is hosted both on http and net.tcp.
net.tcp://localhost:42/Service/MyService.svc
http://localhost:43/Service/MyService.svc
I have tested my service using the WcfTestClient and it seems to work correctly through both basicHttp and netTcp.
However, when i try consume this service through my ASP.NET Website, i receive an error when trying to go through nettcp
My client end point looks as follows
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="Generic_HttpBinding" sendTimeout="00:01:00" receiveTimeout="00:01:00" maxBufferPoolSize="2000000" maxReceivedMessageSize="2000000000">
<security mode="None"/>
<readerQuotas maxDepth="2000000" maxStringContentLength="2000000" maxArrayLength="2000000" maxBytesPerRead="2000000" maxNameTableCharCount="2000000"/>
</binding>
</basicHttpBinding>
<netTcpBinding>
<binding name="Generic_Binding" sendTimeout="00:01:00" receiveTimeout="00:01:00" maxBufferPoolSize="2000000" maxReceivedMessageSize="2000000000">
<security mode="None"/>
<readerQuotas maxDepth="2000000" maxStringContentLength="2000000" maxArrayLength="2000000" maxBytesPerRead="2000000" maxNameTableCharCount="2000000"/>
</binding>
</netTcpBinding>
</bindings>
<client>
<endpoint name="EndPointHttp" address="http://localhost:43/Service/MyService.svc" binding="basicHttpBinding" bindingConfiguration="Generic_HttpBinding" contract="NameSpace.Services.Contracts.IService"></endpoint>
<endpoint name="EndPoint" address="net.tcp://localhost:42/Service/MyService.svc" binding="netTcpBinding" bindingConfiguration="Generic_Binding" contract="NameSpace.Services.Contracts.IService"></endpoint>
</client>
Now i call the service in the exact same way just swapping my end point name
var factory = new ChannelFactory<IService>(SuppliedEndpointName);
factory.Open();
var proxy = factory.CreateChannel();
var result = proxy.SomeServiceMethod();
If i pass this method the basicHttpBinding it works perfectly.
The second i swap to nettcp, i receive this error immediately:
Exception: The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '00:01:00'.
Inner Exception: An existing connection was forcibly closed by the remote host
Error Code: 10054
Please can anyone help me, it driving me crazy.
I have definately installed the WCF HTTP Activation and NON HTTP Activation features.
I have setup my binding to be both HTTP and net.tcp on differen't ports.
I have set my enabled protocols to http,net.tcp in IIS.
I have disabled my firewall.
I have run aspnet_regiis -i for .net 4.0
HELP!
I finally found that changing my security mode to transport fixes the problem.
However my service has it security mode set to none.
So why does my client only works with security mode transport on?
netTcpBinding by default transport security with both signing and encryption. Try removing the security element (<security mode="None"/>).
Also
Ports under 8000 (and definitely under 1024) are normally not safe to be used for services. Try using safe ports.

WP7 + WCF Service: There was no endpoint listening at (URL) that could accept the message

I'm trying to develop a Windows Phone application that uses a WCF Service. I'm doing it as decribed here:
http://www.c-sharpcorner.com/UploadFile/raj1979/5280/
(of course I use my own tables from the DB). The problem is:
I'm debugging the Class Library project containing the WCF service (to see if some of its methods are invoked properly)
after the method returns an entity I see the error: There was no endpoint listening at http://localhost:1708/Service1.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. The InnerException is The remote server returned an error: NotFound.
the ServiceReferences.ClientConfig in the Windows Phone application:
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService1" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<security mode="None" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:1708/Service1.svc" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IService1" contract="ServiceReference1.IService1"
name="BasicHttpBinding_IService1" />
</client>
</system.serviceModel>
</configuration>
I don't know how to solve it. Any ideas ? I tried many answers from that site but none worked
What about Silverlight-enabled WCF service on the server side? It it based on CustomBinding instead of basicHttpBinding.
You must change in ServiceReferences.ClientConfig in your Windows Phone Emulator endpoint address from localhost to
yourComputerName. Thats all:) It works

WCF call with windows authentication

We have a system where the users access a web server, the web server then calls a WCF service.
We would like the call to the WCF service to be made in the security context of the windows identity of the application pool on the web server.
What is the best way to do this? Can it be done purely through configuration in the web.config file.
Thanks
Shiraz
Yes, you should be able to do this, all in config:
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="WinAuth" mode="Transport">
<transport clientCredentialType="Windows" />
<bindings>
</netTcpBinding>
</bindings>
</system.serviceModel>
Of course, depending on your binding, you'd have to use a different tag under the <bindings> parent node - and of course, not all bindings support all security modes.....
In your endpoint, use the appropriate binding and then just reference this config:
<endpoint name="WCFService" address="......."
binding="netTcpBinding"
bindingConfiguration="WinAuth"
contract="......" />
That should do it! And of course, if you need message security instead of transport security, you can do that, too.
In your WCF service method, you can check to see whether or not the Windows credentials have been sent over, and what they are, by checking:
ServiceSecurityContext.Current.WindowsIdentity
This will be NULL if you don't have a Windows caller, otherwise it will show who called you.
Marc