How To Deploy WCF To IIS And Have It Stay Alive - c#

I've created a basic WCF service library project and deployed it to my local IIS installation (7.5).
Whenever I try to navigate to it via localhost/TestWcfServiceLibrary/ I just get a directory view.
However, if I start the service in debug mode from visual studio, I get the system tray popup telling me that it's been hosted, and then when I go back to localhost/TestWcfServiceLibrary/, I'm able to see the wsdl.
As soon as I stop debug mode and refresh the browser, I'm back to the directory view.
The base address in the config file is localhost/TestWcfServiceLibrary/ so I don't understand why I'm seeing this behavior.
Interestingly, if I navigate to localhost/TestWcfServiceLibrary/service.service1.svc (A file that doesn't exist) I get the wsdl even when debug mode is off.
So I have 2 questions.
1) Why does debug mode in visual studio have any affect at all on whether or not I can access the wsdl from the path localhost/TestWcfServiceLibrary ? (I suspect it's because the wcf service is not technically hosted at "localhost", it's hosted at , so the address doesn't really exist until debug mode is turned on, so I'm actually connected to the temporarily hosted version that visual studio provides and NOT the real IIS hosted webservice?)
2) When deploying a WCF service library directly to IIS, is it always correct to point to the .svc file with a the namespace and class name of your service contract, even though that file doesn't really exist (I'm guessing that's the magic that IIS performs for you)?

1) You can see where your webservice is hosted in the Web tab of the properties of your WCF project. Default behavior in VS.NET is to host your project in IISExpress, a mini IIS that comes with Visual Studio.NET and that is automatically started when you run a service. So, if you haven't changed the default then yes, your service is technically hosted at "localhost", but not on port 80 in IIS but on another port in IISExpress (The exact port varies)... I guess it's IISExpress that decides to give you the wsdl when you browse to the service address. That is not default behaviour of IIS. That will show the folder contents if directory browsing is enabled in the web.config, and otherwise gives you a 404 (not found) error.
2) There are 2 ways to activate a WCF service in IIS. Either you provide a real .svc file that lists what service implementation IIS should start. Either you indicate that in the node in your web.config file. It is the .svc part of the URL that triggers IIS to start the service.

Related

Not able to debug an asmx service

I have 2 solutions both running in VS2013 on Windows 10.
One solution is the client which calls the asmx service located on the same host.
Another solutions is the service it self which I launch in debug mode with debug configured in the web.config.
When I want to step into the call I get the message
Unable to automatically step into the server. The remote procedure could not be debugged. This usually indicates that debugging has not been enabled on the server
I run the web service on "Local IIS" in debug mode. In the client I tried attaching the process where the web service is running but also no success.
I added the users "IUSR" and "IIS_IUSRS" to the folders of the web service with full permissions.
Any idea what else I can do to make this work ?

Testing Silverlight Application in other PC without configuring IIS

Newbie here. I have created a Silverlight App which retrieves data via WCF RIA Services. Now I would like test it to another PC so I did a Publish. The folder contains bin, ClientBin (with xap), .html, .config, etc.
I then copied the folder to the other PCe and opened the *.html file
My silverlight app didn't run. Do I really need to configure the IIS for the other machine and deploy the binaries there to see my silverlight application in action?
Thanks!
If you want simply to watch Silverlight UI (without using WCF) you can, of cource, open *.html page with the application. But if your application needs in WCF service, the service should be runned.
If your machines in domain group and you have IIS installed for one of them, you can in Visual Studio in project properties configure use local IIS insted of developers web-server, then you should update service references and then you can browse silverlight app. from within any computer in domain network.

run my Asp.Net Web application on another machine

How can I run my application on another machine, my team member wants to view the webpage in his computer. He doesn’t want to install visual studio but just wants to see the webpage in the browser.
I am using a Mac book
Publish it to a web server, or have him install IIS on his machine and set it up.. wait. That would be publishing to a web server.
In short, an ASP.NET website needs a web server to run. Usually it's IIS, but if you have Visual Studio, it uses the built-in Cassini web server. Either way, you need to have it in a web server of some kind. You can't just run it as a stand-alone program.
I haven't' done this, but I think you COULD have it running in your computer in Visual Studio and still have him see it. If you run it, you'll see that the address is in the format:
http://localhost/:[some port number]/YourWebAppName
If you have it running in Visual Studio on YOUR machine, your team member MAY be able to access it by changing "localhost" to your PC name. It's worth a shot.
Otherwise, here are a bunch of links to how to publish your site, in case you're not sure.
http://www.google.com/search?q=publishing+asp.net+web+sites&sourceid=ie7&rls=com.microsoft:en-us:IE-Address&ie=&oe=
Create a new virtual directory in IIS
Set the directory root to your project root folder.
allow anonymous access.
Your team member can then access it at http://yourmachinename/virtualdirectoryname
This looks like a good job for IIS express http://learn.iis.net/page.aspx/868/iis-express-overview/
For the majority of things, it's functionally equivilent to using regular IIS 7.5, with the exception that it's easier to start new websites with this. You simply use the command line to start IIS Express, point it to your physical path, set the CLR version, and the port, done!
http://learn.iis.net/page.aspx/870/running-iis-express-from-the-command-line/
There's some instructions for how to do that.

Web Reference in Visual Studio does not exsist...so cannot update

Basically, I have a web Service which I developed. I then went down to the installation site to install the web Service and a handheld app which uses it.
Problem is, I came back off site, and now need to change some things with the handheld app and web Service, and send it to them (site is hundreds of miles away).
I can change the web service fine, but how can I change the web reference to that web service, on the handheld app? its pointing to a location that does not exists as there is no remote access to their servers.
How can I trick Visual Studio into updating the web reference to get my LOCAL objects, but compiling to keep the web reference that only exists on THEIR local servers?
You can configure the url that the webreference is using by setting it to dynamic. It will add the url to the config.
Also see: http://www.codeproject.com/KB/XML/wsdldynamicurl.aspx

Debug C# web service

I have a web service project and simple test application. I can debug the web service from Visual Studio 2008. However, there exist a real client application, but it is on another machine. ASP.NET Development Server does not allow connections if they are not from localhost, or so it seems. Is there a way to debug a web service, if client application is on another machine?
Edit
The tool that I used is Trace Utility from Microsoft SOAP Toolkit. Further explanation can be found here (works on XP; see continuation story for Windows 7 solution). There was problem with it though. My remote client fetches the WSDL first, and then creates URL based on values in soap tags found at the end of WSDL. So client gets redirected to localhost, which is not good.
I found my problem though, but I'll leave the question open until I find the time to try debugging via IIS.
Install a virtual directory into the IIS on your local machine. If you don't have IIS, install it. Once IIS is installed and configured on your local machine, you should be able to use either the IP or create a dns alias for that IP to access the web service that way.
I'm using SoapUI basic version to fake the SOAP requests to the web service, which is running in debug mode in Visual Studio, from the local computer.
You can use IIS (or Cassini Web server) - for debugging, attach VS 2008 to correct process (for example w3p.exe(IIS6 or greater) or aspnet_wp.exe(IIS 5)).

Categories