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
Related
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.
I'm trying to setup my Web service client to use fiddler proxy by setting it in the webhttpbinding configuration file as follows:
<bindings>
<webHttpBinding>
<binding name="RestBinding" proxyAddress="http://localhost:8888"
useDefaultWebProxy="false">
</binding>
</webHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:2172/RestServiceImpl.svc"
binding="webHttpBinding" behaviorConfiguration="RestService"
bindingConfiguration="RestBinding"
contract="IWS.IRestServiceImpl" name="Rest"/>
</client>
This doesn't seem to work. I don't see anything logged in fiddler when calling the webservice from the client. I know the call is being made because I get a response back from the service.
I can't seem to figure out what I'm doing wrong.
Any help is appreciated!
Thanks!!
The .NET Framework does not send requests for "localhost" to any proxy, including Fiddler. To workaround this, try to use your machine name instead as the endpoint address (e.g. http://mymachine:2172/RestServiceImpl.svc).
Also, take a look on Using Fiddler with IIS7 Express
I need some help with hosting a WCF service in WAS.
I hosted the service ok in IIS and accessed over basicHttp and wsHttp binding.
But it seems I miss something when trying to host it in WAS and access over tcp/ip.
I need to configure it for access over tcp on port 10000.
I enabled WCF activation for Non-HTTP in Windows Features
The service is published under default web site, application mywcfapp
I created a BAT file to enable net.tcp binding on port 10000 on default web site and mywcfapp as below:
%windir%\system32\inetsrv\appcmd.exe set site "Default Web Site" -+bindings.[protocol='net.tcp',bindingInformation='10000:*']
%windir%\system32\inetsrv\appcmd.exe set app "Default Web Site/mywcfapp" /enabledProtocols:http,net.tcp
The web.config is
<services>
<service name="MyWcfService">
<clear />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"
listenUriMode="Explicit" />
<endpoint address="net.tcp://localhost:10000/mywcfapp/mywcfapp.svc"
binding="netTcpBinding" bindingConfiguration="PortSharingBinding" contract="MyApp.IService" />
<endpoint address="net.tcp://localhost:10000/mywcfapp/mywcfapp.svc"
binding="netTcpBinding" bindingConfiguration="PortSharingBinding" contract="MyApp.IService" />
</service>
</services>
<bindings>
<netTcpBinding>
<binding name="PortSharingBinding" portSharingEnabled="true">
<security mode="None" />
</binding>
</netTcpBinding>
</bindings>
However, it seems I cannot access the service.
When I try to access the service with WcfTestClient with the uri
net.tcp://localhost:10000/mywcfapp/mywcfapp.svc/mex
I get the following error
<Fault xmlns="http://www.w3.org/2003/05/soap-envelope">
<Code>
<Value>Sender</Value>
<Subcode><Value xmlns:a="http://www.w3.org/2005/08/addressing">a:DestinationUnreachable</Value>
</Subcode>
</Code>
<Reason><Text xml:lang="ro-RO">
The message with To 'net.tcp://localhost:10000/mywcfapp/mywcfapp.svc/mex'
cannot be processed at the receiver, due to an AddressFilter mismatch
at the EndpointDispatcher.
Check that the sender and receiver's EndpointAddresses agree.
</Text></Reason>
</Fault>
If I try to connect with url (w/o specifying port)
net.tcp://localhost/OneTest.Service/OneTest.Service.svc/mex
I get the error (kept only significant part)
Could not connect to net.tcp://localhost/mywcfapp/mywcfapp.svc/mex.
The connection attempt lasted for a time span of 00:00:02.0041146.
TCP error code 10061: No connection could be made because the target machine actively refused it 127.0.0.1:808.
No connection could be made because the target machine actively refused it 127.0.0.1:808
This might help:
Go to IIS Manager.
Right click on the app.
Choose Manage Applications -> Advanced settings
Under Behavior, there is a field for Enabled Protocols.
Make sure it has net.tcp
If it just has http, change it to
http,net.tcp
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
We have a windows service that we are trying to use as WCF host for a WPF application. It works fine in development but when we have tried to move to our production environment we have had nothing but problems. From reading posts from others, we figured out how to turn on WCF logging and this was a big help. It turned out that our security bindings on the service and the client did not match. We set them both to use windows security but still no luck now we are trying to set the security mode to 'None' but it still is not working. Here is the bindings section of our service config file:
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="netTcp">
<security mode='None'>
</security>
</binding>
</netTcpBinding >
</bindings>
<services>
<service name="CompanyService">
<endpoint
address= "our.url.com/CompanyService"
binding="netTcpBinding"
contract="CompanyServices.ICompanyService" />
</service>
</services>
</system.serviceModel>
Here is the serviceModel section of our client app config:
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="NetTcpBinding_Config" >
<security mode="None">
</security>
</binding>
</netTcpBinding>
</bindings>
<client>
<endpoint address="our.url.com/CompanyService" binding="netTcpBinding" bindingConfiguration="NetTcpBinding_Config" contract="CompanyServiceProxy.ICompanyService" name="NetTcpBinding_ICompanyService" />
</client>
</system.serviceModel>
If I need to supply additional infor please tell me what I need to supply.
Thanks
Standard net.tcp binding uses Windows credentials by default, and those really require client and service to be in the same Windows domain. Is this the case here??
OK, sorry, you mentioned security=None (your listings weren't properly formatted so I only saw a fraction of the actual config).
I guess your problem really lies in the addresses used:
address= "our.url.com/CompanyService"
When using net.tcp binding, you have to specify that before the address, so change this on both the client and the server to:
address= "net.tcp://our.url.com/CompanyService"
Also, what I don't quite understand is your title: it mentions "streaming" - have you specified streaming mode anywhere? In your config or your service contracts?
Marc