Reputation: 1422
I have searched a lot for methods of hosting the WCF
and found them to work, however, in my a Solution I have WCF Service Project
(it has a web.config
with some connection strings) and a ASPX.NET
project( it also has a web.config
), could any one please clarify on how I can host them in a website.
Thank you.
Upvotes: 0
Views: 408
Reputation: 595
Do you want any other client to access this WCF service?
If not, just keep a .svc file in your existing web application and use it whenever you need.
If yes, host the WCF project as a website in IIS, console or WAS and refer it from your aspx web application.
Upvotes: 1
Reputation: 2963
Its simple, you just need to add a '.svc' file to your ASPX.net project. e.g. Service1.svc
Then add the following code to the file
<%@ ServiceHost Language="C#" Service="WCFServiceProject.Main" %>
The WCFServiceProject.Main is the fully qualified namespace and name of the class that provides the functionality of your service
You will also need to register the svc extension in IIS for it to work if you haven't already. And don't forget to add the reference to the WCF service project to the aspx.net project.
If you want to create the service dynamically then see my question for some hints Creating wcf service within IIS in code
Just reread the updated (edited) question. You'll need to copy the connection details from the WCF service project into your asp.net project.
Upvotes: 1
Reputation: 41767
For hosting a WCF service you have the following options:
See here for more information on hosting a WCF service.
For hosting an Asp.Net application I'd recommend using IIS, see here for how. However, using WSE it is also possible to host it as a windows service. See here for how.
Upvotes: 1