I am writing a WCF webservice. I need to access the service from another ( linux ) machine.
On my PC, I can access the url via 'localhost' just fine, however accessing it from another machine ( replacing localhost with the machine's name ) does not work.
I am relatively new to WCF and my guess is I need to configure it to allow requests from other machines, but I do not know how to do this.
Here is the output from netstat if it helps. Thanks!
C:\Users\bb\Desktop>netstat -na | findstr 57566
TCP 127.0.0.1:57566 0.0.0.0:0 LISTENING
How are you hosting your service? IIS or the built-in web server from Visual Studio? If it's the Visual Studio ("Cassini") web server, you cannot access it from other machines.
See this Stack Exchange question, which is similar: https://serverfault.com/questions/82899/can-i-access-cassini-from-a-remote-machine
Microsoft wants you to deploy your application to IIS for remote connections. Cassini (the Visual Studio web server) is purely for development purposes.
Are you running the service using Visual Studio? The ASP.NET Development Server, which Visual Studio uses by default, can only be accessed from localhost. Depending on what you are doing, you may be able to use IIS Express from within Visual Studio. Otherwise you will need to host your service in IIS.
Related
I am trying to run a custom site on IIS with ASP.NET whih connects to a site on the internet which is a coding community via HttpWebRequest.
If I use the Visual Studio built-in Development Server it successfully runs and shows the result of the Request.
But as soon as I use the local IIS for running the application I get an error saying that the site (which I am trying to connect to) is refusing the connection.
But there has nothing changed right? I have not changed my code at all!
EDIT: My understanding is that the IIS and VIsual Studio's "On-The-Run" IIS are in base the same. But why are they acting so different here?
Web applications in a production environment are hosted using Microsoft's IIS web server software. In the development environment, however, the application may be hosted using IIS or the ASP.NET Development Server. Ideally, the same web server software should be used in both environments because using different software adds another variable in the mix. However, the ease of use of the ASP.NET Development Server makes it an attractive choice in the development environment. The good news is that there are only a few fundamental differences between IIS and the ASP.NET Development Server, and if you are aware of these differences you can take steps to help ensure that the application works and functions the same way regardless of the environment.
Visual studio uses IIS Express to host your application, which is a lightweight, self-contained version of IIS. It is used by developers to develop and test websites inside the same machine(localhost). The major difference between IIS and IIS express is that IIS express doesn't accept request outside the localhost. while IIS accept the web request from any another machine inside the domain. SO in order to accept request from your application you have to deploy it to IIS not IIS express.
What would be the best (or easiest) way to setup a development environment in order to:
- develop iOS(iphone) application using Xcode in a MAC
- iphone app will be calling .NET web services written in C# (windows laptop)
- the database is MS SQLServer 2008 R2 (windows laptop)
I understand that I could do all this in my MAC if I was using PHP/MySQL but I really need the C#/MS SQL combo.
Thanks in advance.
Ceta
If you don't have access to a dedicated Windows environment for development, I would suggest that you install VMWare Fusion or Parallels on your Mac, and do your Windows development in a VM.
Can you not just deploy the Webservices (on the web?) and just test your API calls remotely?
Alternatively, network the machines so you can access the development copy, or use something like Parallels Desktop to run Windows inside your Mac environment. Related: Visual Studio on a Mac
If you have both machines up and running, XCODE, VS and SQL Server already installed, then I don't see the problem.
You only need to configure the special things in your Windows Machine so its perfectly suited for Web Services development. Skip the steps you may already have done.
1) Install IIS 6 / 7 (depends on your windows version)
2) Install ASP.NET
3) Turn off your firewall for Home network, or configure some permission for allowing inbound traffic to the HTTP/HTTPS ports.
4) Make sure you have an static IP address in your home network, or, make sure your machine name is DNS resolvable from your Mac.
You need IIS because Visual Studio internal web server doesn't allow remote connections.
Now, how can you debug your C# code if the Web Service is running in IIS? two options:
1) (easy) In the solution explorer, right click on your web project, choose properties, chose Web, in the section named "Servers" choose use local IIS WebServer and name your virtual folder. You'll be able to debug easily.
2) (medium) You can just publish your web app to your local IIS, make it run, and then from visual studio using the debug -> attach to process menu attach yourself to the w3wp.exe. The problem is, if you have several application pools, have fun finding your application.
I am having a C# based winforms or ASP.NET application deployed on my laptop which has to remotely connect to a windows service. The protocol mentioned in config file is TCP-IP as follows:
<wellknown url="tcp://LaptopMachineNAme:8085/MyService" type="MyController, MyOwn.AppTier" />
What would happen if the 'windows service' is also installed on my laptop?... Will the winforms or ASP.NET application be able to establish the "remote connection on the SAME machine"...???
There is no problem connecting to the service which is installed on the same computer. I would use named-pipes for this task, there is no problem having 2 (or more) bindings to the same service.
Doesn't even pass the FW IMO, when trying to connect to yourself...
I've done some projects that are using WinForms/ASP.NET combined with Windows Services on the same host - works perfectly fine
I've tested pretty many solutions having client and server working on the same machine. Should work. You can use localhost as machine name.
I have a C# web service that I am trying to debug in Visual Studio 2008, and when I try to run it, Internet Explorer pops-up as expected, but it just displays 'waiting for response from localhost...' in the status bar. I have left it running for a few minutes and it never responds.
I have other web services that I am able to debug fine, is VS2005 and 2008. The problem web service is impersonating a different identity in the web.config file, but I have no problems with this same user on a different web service (in VS2005).
Does anybody have any ideas on what might be preventing it from starting up? Interestingly, a colleague has the same problem with a web service that IS working on my machine, even though we are working with identical code. Something must be configured differently...
By the way, I've noticed that the 'Temporary ASP.NET Files' folder is missing from both
C:\Windows\Microsoft.NET\Framework and C:\Windows\Microsoft.NET\Framework64... I certainly haven't deleted them, and other web services debug okay, so is this just a red herring?
We are also on a domain which has its own firewall (outside of the developers' control) - could this be blocking it?
EDIT: I have just removed the user impersonation for a quick test, and it worked. So there must be something about Visual Studio 2008 that does not want to run when impersonating THIS particular user. Any ideas what configuration I would need to change to correct this?
I have had the same issues with impersonation; I don't know if Cassini (the built-in VS web server) supports this properly. About the best advice I can give is to either use Local IIS with an app pool running as your impersonated user or to attach your debugger using remote debugging to a remote IIS server.
I believe using Local IIS will attach correctly & automatically if configured as much in the Web tab of Project Properties. You'll have to run VS as an admin to get the virtual directories setup automatically by VS in IIS.
I made a site using VS10 Ultimate [ASP.NET] and when I build & run it runs the severer locally, while I want to test it for security issues via Linux.
How can I run it globally ?
Thank you!
Your development machine probably has IIS installed. Copy the code or the compiled code to the web root of this installation. If you want to put it on another computer, then that will need to have IIS, relevant version of .Net installed.
It would also help if you can setup your local DNS to resolve the name for your computer within the LAN setup so that you can reache the machine using a name rather than the IP.
This will allow you to test the security issues that are client side. For Server side security issues, you will need to create a server in your LAN that is configured similar to the actual server where you would be hosting your site.
You need to set up the site in IIS Server installed in your Windows machine to run it locally
See the links to learn more:
http://www.beansoftware.com/ASP.NET-Tutorials/Set-Up-IIS-ASP.NET.aspx
http://support.microsoft.com/kb/323972
You need an ASP.NET hosting service.