Hosting Web Service/WCF Service? - c#

I'm new to Windows Azure and I'm trying to deploy my web application to Windows Azure.
In my app I used some web services, now I would like to know how can I build them in windows azure and include that web reference in my web app?
Some tutorials said that I have to import my current web service into a Cloud Service Project as a WebRole but in my web serivce folder, there's no csproj file.
Thanks!

I found out that I just have to create a new Window Azure Project and add a WCF Service Web Role, copy my old files in the old Web Service (maybe change a little bit if it's ASMX) then host it the same way as web application. And voila, everything is ok now :)

I think you should use a WebRole for a web service, but you can use a WorkerRole though.
Take a look on this:
http://www.devproconnections.com/article/windows-azure-platform3/Hosting-WCF-Services-on-Azure-101.aspx

Related

Combining WCF Service Library and WCF Service Application

Thanks to Stack Overflow and a few other sites, I understand the difference between the WCF LIbrary and WCF Service Application templates.
Briefly the Library is a DLL that allows for multiple types of hosting. It does not have a .svc file. While the Service Applications template is created specifically with IIS in mine with a .svc file.
I read that WCF Service Library is the best way because it is the most flexible. But I NEVER see instructions on how to do it apart from using the WCF Service Application template.
Is it difficult to go from WCF Service Library to hosting on IIS from scratch? I have two books on WCF and I've read numerous articles and none of them cover how to create a svc file using only the WCF Service Library and No WCF Service Application. Why?
Nigel Shaw also mentions on the following link that there are limitations to using the Library option. What is the purpose of WCF Service Library?
Basically What I want to do is host the WCF Service on both IIS and a Windows Service. Thus it appears that the combined way is the best way. Nevertheless, I'm trying to learn why there aren't more instructions on using the WCF Service Library.
Ok, I did find a couple of articles that seem to use an ASP.NET Web Application and tells you how to create a text file for the svc file.
This article: http://debugmode.net/2010/12/25/wcf-service-library-creating-hosting-and-consuming-wcf-service-with-wcf-service-library-project-template/
and this one: http://danielvanwyk.wordpress.com/2010/04/30/create-host-and-consume-a-wcf-service-using-the-wcf-service-library-template-in-visual-studio-2008/
But what I still don't understand is why is the ASP.NET Application still needed? And If i add a svc file does it get placed in the wwwroot directory (that seems to be where the WCF Service Application places it .svc file?
Thanks!
A WCF Service Library has to be hosted in order to be used - you can host it in IIS, a Windows Service or some self-hosted option (like a console app, WinForm, WPF, etc).
In the last two links you provide, they're demonstrating how to host the library in an ASP.NET service application, but you don't have to use that project template to host it. It's simply one option out of several.
You can create an IIS-hosted implementation of your class library without using a VS project template, but you'll need to manually add the .svc file and the Web.config. I have done this several times:
Create a folder (I normally put mine in the wwwroot folder of inetpub, but you can put it wherever you desire).
Create a bin folder in the folder you created in step 1, and put the WCF service library and any other required assemblies in it.
Add a .svc file with the appropriate markup in the folder created in step 1.
Add a Web.config with the appropriate service model configuration in the folder created in step 1.
Create an application in IIS that points to the folder you created.
Now you have an IIS-hosted instance of your service. You can then use another copy of the WCF service library for your Windows-Service hosted instance.

Solution with web project and web service deployment to azure

I have one project solution in which I have one web project and another project is service. Now if I run it locally, it is working fine without any problem but when I deploy it on to cloud (azure specifically), its looks up and starts running but moment it tries to access the service which is used for log in mechanism it is showing an error.
As I don't know how to trace it on to azure, I'm unable to find actual root cause of it.
While publishing it to azure, I have just marked my main project into web role. Do I need to add anything else in web role node while deploying package to azure?
To perform diagnostics during development, one useful technique is to activate Remote Desktop on the cloud instance and connect to the server to check the event logs for errors.
If you have Visual Studio Ultimate, you can also use Intellitrace to collect debugging information on the published cloud service. See Debugging a Published Cloud Service with IntelliTrace and Visual Studio.
You can also debug locally using the emulator. See Debugging a Cloud Service in Visual Studio.
As for your project architecture, you have a few alternatives:
Add a web role for each project; i.e., one web role for the web project and another web role for the service project. This will create two instance groups, and one of this roles will be assigned the TCP port 80; the other role will be assigned another port such as 8080.
Add both project in a single web role as distinct web sites. See Configure a Web Role for Multiple Web Sites, Tips for Publishing Multiple Sites in a Web Role, One Azure Web Role, Multiple Websites.
Reorganize your solution so that you have a single website project that also has the service definitions, and keep the service implementation in a separate class library project. This way you would have one web role and one web project with both the website and the services.

Host developed wcf service on azure

I have ready project in silverlight, which is using wcf services.
I have one project for silverlight app and another for wcf services.
Can I move this wcf services from project to azure simple?
Or I have to rebuild all project.
There are 2 options.
Host your project as an IIS project on a Windows Server Virtual machine in Azure. No coding would be necessary, but you'd have to move your project to IIS.
Recode your Project as an Azure Cloud Service. It's not that difficult. I show an example of how to do that with an ASMX service in the below video, but moving a WCF service should be much easier than even this was.
Video is at:
http://www.youtube.com/watch?v=oQbMnoG56lk

How to deploy WCF in Windows Azure

Here
and here it is written how to convert a standard WCF Service to Windows Azure. It is written, that after right-click you will have an option to "Add Windows Azure Deployment Project". But still I do not see it in Visual Studio in my project after right-click at the WCF Application project.
This is the screenshot:
What is wrong? How to deploy it in Windows Azure?
As I told you in the other post this should normally work. But since it does not I propose copying over your WCF interfaces, classes and configurations to a brand new WCF Service Role project. Then you will be able to publish it to Windows Azure directly without any problems.
Please check the following link Code Quick Start: Create and deploy a WCF service in Windows Azure

wcf service application deploying issue

I am new to wcf. I have developped a wcf service application(not a library). Can someone tell me how to deploy it other than iis. And how to access the service as a webservice. is this possible and how?
This link has an example that shows how to deploy a WCF-service as a servicehost application.
This means it runs as a service and does not need to be deployed to an IIS-instance.
There is an automatic WCF deploy tool in Visual Studio or copy the code to the server.
The server will be access like through a website like http://localhost:2342342432342/YourWebService.Svc.
You have to get the references from the WS using a tool that generates all the classes for you and you use that service's classes to write your code.
If your intention is to deploy to to a server that does not use IIS for hosting, you could look at an alternative hosting application like Cassini.

Categories

Resources