I am sorry in advance for the question because it should be so easy for someone who has web programming experience, but for me ...
I have created a WCF library which gets an email address, subject and body and sends email using a gmail account. I do not know how I can deploy it.
I already published it on my host using visual studio but don't know what URL should I use to call it. Can I use it directly or I have to create a WCFapplication and add the service to it then publish the WCF app?
Also, I noticed the base address in its config file is sth like: localhost/emailservice/service1 and I am not sure if I should edit it or not and how.
Your help is greatly appreciated.
Since you created a WCF library, I am assuming that you are open to host it as an IIS application or as a windows service.
Assuming that you wish to host your library as an IIS application, follow the steps mentioned in this blog to host your WCF service library.
Please note: If you intended to host your service as an IIS application, it would have been far easier for you to create a WCF service application project in Visual Studio instead of a WCF service library project.
Related
I understand what the differences are between a WCF Library and a WCF Service. I typically will build a WCF Library and reference it from a WCF Service. But if I am going to deploy to IIS, why not just deploy the WCF Library and forget about creating the WCF Service. Does it matter which one I deploy?
Answering my own question: From what I have read it doesn't seem to matter much if you deploy a wcf library or a wcf service. If you deploy the library, make sure that you copy the contents of your app config file to the web config file. The wcf service does also provide an svc file, but you only need that if you are using an earlier version of .net framework other than 4.0 or later. If you deploy the service instead of the library, the App config file for the service will pass the content onto the Web.config file when it is deployed. I am pretty sure that these are the only differences. The two people that replied to my question didn't really take the time to read and understand the question. It got marked as a possible duplicate, which clearly it is not.
I read about how to host Wcf Service in a Windows service. There is a guide here:
http://msdn.microsoft.com/en-us/library/ms733069.aspx
But what I did was just to create new WCF Service class and interface inside the same project of the Windows Service instead of creating a new project separatly for the Wcf service.
Is it possible to do it? because I can't add a service reference to that service from other projects in the solution. It can't find it.
OK, here is what I found.
Creating a new solution with one Windows service project with a Wcf service class and one Asp.Net folder.
Running the Windows service.
Trying to add a Service reference to the Asp.Net project.
Result: Service can't be found.
Adding a new project which contains a Wcf project to the solution.
Adding a reference to it from the Windows Service.
Trying to add a Service reference to the Asp.Net project.
Result: Service found.
Reading this link:
http://msdn.microsoft.com/en-us/library/ms731758.aspx it's done similar to what I did in the test solution, but still there is a need to write some code in the Windows Service.
In this link:
http://msdn.microsoft.com/en-us/library/ms731758.aspx
They show how to host it without creating a separate project.
So the answer to the question is no, you must not, but you have to write some code for hosting the service and can't just use the configuration file.
Note the windows service must be running so you can successfully add the reference.
I've gone through some tutorials on creating a WCF service. I'm using Visual Studio 2012. I got a very simple WCF Service Library (vb.net) and Windows Application (vb.net) communicating via WCF. That's a start.
However, my project requires I do the following:
My Windows Service - This is already an application that has it's tasks.
My Application - This is an application that is already developed as well.
I need the service to talk to the application. The service will need to send the following information to the windows application:
Status Updates
Metric Information (mostly integers for counts)
I need the application to send information to the service. It would need to send:
Reload Configuration command
Should be relatively simple, but I've never worked with WCF until today. So I have some questions...
Do I need to re-work my current windows service into a WCF Service?
Since it won't be in IIS, do I also create a WCF Service Library or do I roll this into the windows service somehow?
What is the best way to set up the different types of communication? (i.e., sending over specific metrics and reload commands)
Probably the main question is what components, in addition to my current windows service and application, will I need to make this work?
I hope that was clear :( I think I'm confusing it all... but I hope not
Your Windows service can host the WCF service. Similarly, if you want, your application can host a WCF service. The application could talk to the WCF service in the Windows Service, and the Windows Service's WCF could talk to the one in the application. Depending on the nature of the communication, you could also just use a callback channel to permit the Windows Service's WCF to call back to the application.
I suppose you should configure your WCF windows service to use named pipes. If your windows service is already built then the easiest way to do it would be to build another one as a WCF windows service and wrap the already existing functionality.
Hope I helped!
i've created simple windows service which gets some xml information once in a hour. I want to have access to this xml information from a website. I know i should create WCF service for that but where do i host the WCF service same application as Windows Service or elsewhere?
If someone knows about blog post or tutorial how to make this work, i would be glad to know.
Thanks
Store your XML information in a database and have your website get it from there.
you can host wcf services inside a windows service if you want, just manually create a ServiceHost.
I have created a library which reads the app.config file and gets the type of WCF service in which it is called.
Now, I have a separate console application, I want that this library informs the console application about the type it found in the WCF service so that the console application can host it.
It is useful because then I will just add my library in any WCF service and call its method and it will then inform my console application and it will host it.
Please give me an idea on this problem.
I have to agree with Marc, but this is perhaps related to your question regarding ServiceHost, but what is the purpose of your console application?
Is it acting as a host or as client (consumer of the services). If its a host I would simply add the appropraite configuration in the app.config?
HTH
Phil'