I created a website on IIS at 192.168.0.163, and published a wcf service application on it, I can get wsdl of service through hostname hostname:port/Service.svc?wsdl and ip address 192.168.0.163:port/Service.svc?wsdl, but hostname.domain.com:port/Service.svc?wsdl not work, on another computer in same domain.
At the end of wsdl, I found the service address is ws://hostname.domain.com:port/Service.svc.
In client, I added service reference by vs2015, in app.config the service address also is ws://hostname.domain.com:port/Service.svc, and I can only connect to service from local computer which IIS stays, calling from another computer will cause a exception:
The remote endpoint requested an address for acknowledgements that is
not the same as the address for application messages. The channel
could not be opened because this is not supported. Ensure the endpoint
address used to create the channel is identical to the one the remote
endpoint was set up with.
If I change address to hostname:port/Service.svc or 192.168.0.163:port/Service.svc, then I faulted to access the service from both computers with same error.
Close firewall can't solve the problem.
How to make this work?
Solved after add hostname in IIS bindings.
Related
I have an application containing a WCF Data Service using SSL. I have a domain level certificate and a localhost certificate. I am using Local IIS to host the data service. I can access the WCF Service on my computer from another computer using
https://mycomputer.mydomain.com/MYDataService/ServiceName.svc
When I try that on my computer, it says it can't establish a secure connection. From my computer, I can use
https://localhost/MYDataService/ServiceName.svc
and it works. This is fine most of the time, but I have a windows forms application that I use for testing and some maintenance tasks. It is part of the solution containing the web service. To configure the web service, I use the Add Service Reference function and use the Discover feature. It configures the service fine as connecting to localhost. When I run the program, I get the following error:
Could not establish trust relationship for the SSL/TLS secure channel with authority 'mycomputer.mydomain.com'.
I have looked at the Configure Service Reference settings and it says localhost, but according to the error, the client is somehow trying to connect to the actual computer name. Has anyone run into this before?
I've managed to get my WCF service working on IIS express and IIS locally via localhost. I was wondering how I can deploy the service so that it can be accessed outside my network i.e http: // public ip. I've done a lot of digging around and can't seem to find the right answer.
I've tried setting the IP bindings on IIS to my public IP but I get 'Bad request - invalid hostname'.
I have opened all necessary ports and host my own apache server which is accessible outside my network, so I know that the ports side of things is fine. I'm just having issues with the server hosting (IIS).
Any ideas how this can be achieved?
Suppose I've one WCF service hosted in a Windows service running on a machine on LAN. I want to make this service to be consumed by applications running on other machines on same LAN. Further assume I've hosted WCF service in a Windows service using TCP. So the app config file will have the base address mentioned something like this:
<add baseAddress="net.tcp://localhost:8523/Service1" />
My question is will this service be accessed by clients over LAN though I've mentioned localhost? What is the right way to mention base address so that service could be consumed by clients on LAN? Is any arbitrary address is valid? If localhost is valid, which port shall I mention?
you need to specify the actual ip. i think localhost is just for the current machine. localhost is an alias for the default address 127.0.0.1
I have simple web service (asmx) running on my PC using port 7778.
I've assigned the app pool (v2), port forwarded 7778 on my router to resolve to my local IP address (192.168.1.2) that I've set up manually (static local ip address). I've also used NoIP's service for DNS and this is checking if my non static real Ip address changes.
when I try to connect to:
http://mynoipdnsname.no-ip.biz:7778/Service1.asmx from any computer outside my local network
It's all working,
using:
localhost:7778/Service1.asmx or
192.168.1.2:7778/Service1.asmx
from my local PC works fine.
The problem is that when I try:
http://mynoipdnsname.no-ip.biz:7778/Service1.asmx
from my local computer (192.168.1.2)
it's not getting the data.
I have Android app, when I try to add web service's url:
http://mynoipdnsname.no-ip.biz:7778/Service1.asmx
I get error message:
Unable to connect to the remote server No connection could be made
because the target machine actively refused it
Any ideas what I've missed?
Thanks in advance.
P.S. My windows firewall and router firewall are turned off.
Add mynoipdnsname.no-ip.biz to your hosts file or your DNS.
Can I host a WCF Service using netTcpBinding which is accessible (please note i am asking about ACCESSIBLE means browsable) in the same machine (localhost) and not outside the localhost... not even intranet.
I should think so, as long as the port it's running on is not externally accessible (e.g. blocked by a firewall).
This can also be done at hosting level (in IIS):
open IIS manager
select WCF service application folder
open "IP Address and Domain Restrictions"
if it's not there, you have to add the "ip and domain restrictions" role to the server
in "ip address and domain restrictions" enter an allow entry for 127.0.0.1
then under "edit feature settings" set "access for unspecified" to Denied
Doesn't matter how the service is setup, IIS won't allow access outside 127.0.0.1
EDIT: This feature is not available on IIS 5.1 (Windows XP). You're going to need a firewall, or check out IIS Express.
You can host WCF services by using IIS (only 7.0 or higher for net.tcp) or as windows service.
For IIS you should create site or web application and add binding with port for net.tcp protocol.
There is no difference between hosting on the localhost and on a remote computer.
In general, it is better to use NetNamedPipeBinding for local connection
As suggested by, Henk Holterman
NetNamedPipeBinding is the best approach when we host the service inside a loaalhost and the service requires just intra process communication like communication with another WCF in the same machine or say a .Net client present in the same machine...
Again, netNamedPipeBinding makes the communication faster because
1) Serialization takes place in binary format
2) unlike netTcpBinding where we communicate through a Port, netNamedPipebinding uses named pipes to communicate between process.
Thanks.
Suraj