473,516 Members | 2,865 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Hosting 2 WCF Service in one windows service

Hi all,
Ý am working aboot WCF. and i have some problems.
I created 2 interfaces containing [ServiceContract] attribute at the
top of them.and i want to create two classes implementing these
interfaces.One class implements one interface the other one implements
the other interface.The classes have different imstancecontextMode and
different bindingtypes.So how can i include two different services to
the service's configuration file .(this issue is not about using one
more endpoint in a WCF service.using two servis contract and two class
in WCF library)
Best Regards
Hakan Fatih YILDIRIM
MCP
Dec 27 '07 #1
9 4296
Hakan,

Well, you are going to have your <serviceselement in the config file,
all you have to do is add one more <serviceelement with the address,
binding, and contract you want to expose.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Hakan Fatih YILDIRIM" <hf*********@gmail.comwrote in message
news:d5**********************************@s8g2000p rg.googlegroups.com...
Hi all,
Ý am working aboot WCF. and i have some problems.
I created 2 interfaces containing [ServiceContract] attribute at the
top of them.and i want to create two classes implementing these
interfaces.One class implements one interface the other one implements
the other interface.The classes have different imstancecontextMode and
different bindingtypes.So how can i include two different services to
the service's configuration file .(this issue is not about using one
more endpoint in a WCF service.using two servis contract and two class
in WCF library)
Best Regards
Hakan Fatih YILDIRIM
MCP
Dec 27 '07 #2
thanks for your reply.But it doesn't work.although i gave the address
of the service.in exception,"there is no configuration file or adress
for [second servisname] ". but with one service it has no problem.

Best Regards

Hakan Fath YILDIRIM
Dec 27 '07 #3
Well, you probably are not setting up your config file correctly.

Can you show what you have for the config file that works, and the one
that doesn't work?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Hakan Fatih YILDIRIM" <hf*********@gmail.comwrote in message
news:39**********************************@l6g2000p rm.googlegroups.com...
thanks for your reply.But it doesn't work.although i gave the address
of the service.in exception,"there is no configuration file or adress
for [second servisname] ". but with one service it has no problem.

Best Regards

Hakan Fath YILDIRIM

Dec 27 '07 #4
again,many thanks for your speed replies.it is so urgent for me. i
mean that for only one single service it has no problem.but if i
include the second service in <servicestags.the exception is thrown.

Dec 27 '07 #5
Hakan,

And you need to post the config files so that we can make sure you are
setting them up correctly.

Also, are you setting up two instances of ServiceHost?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Hakan Fatih YILDIRIM" <hf*********@gmail.comwrote in message
news:e2**********************************@t1g2000p ra.googlegroups.com...
again,many thanks for your speed replies.it is so urgent for me. i
mean that for only one single service it has no problem.but if i
include the second service in <servicestags.the exception is thrown.

Dec 27 '07 #6
yes i didn't use multiple inheretace. i used two class nad two
instance in the WCF library

Dec 28 '07 #7
And are you going to post the config file for the services? I've asked
about three-four times now.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Hakan Fatih YILDIRIM" <hf*********@gmail.comwrote in message
news:03**********************************@n20g2000 hsh.googlegroups.com...
yes i didn't use multiple inheretace. i used two class nad two
instance in the WCF library
Dec 29 '07 #8
Hi again,
This is my confi.file

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<services>
<service name="PerCall.service1">
<endpoint contract="PerCall.IPerCall" binding="basicHttpBinding"/>
</service>
<service name="Singtetone.service1">
<endpoint contract="Singtetone.ISingletone"
binding="wsDualHttpBinding"/>
</service>
</services>
</system.serviceModel>
</configuration>

and enpoints defined in here for each :

(For percall instance):

namespace PerCallHoster
{

internal class MyServiceHost
{
internal static ServiceHost myServiceHost = null;

internal static void StartService()
{
//Consider putting the baseAddress in the configuration
system
//and getting it here with AppSettings
Uri baseAddress = new Uri("http://localhost:8080/
percall");

//Instantiate new ServiceHost
myServiceHost = new ServiceHost(typeof(PerCall.PerCall1),
baseAddress);

//Open myServiceHost
myServiceHost.Open();
}

internal static void StopService()
{
//Call StopService from your shutdown logic (i.e. dispose
method)
if (myServiceHost.State != CommunicationState.Closed)
myServiceHost.Close();
}
}
}


(for Singletone instance) :

namespace SingleToneHoster
{

internal class MyServiceHost
{
internal static ServiceHost myServiceHost = null;

internal static void StartService()
{
//Consider putting the baseAddress in the configuration
system
//and getting it here with AppSettings
Uri baseAddress = new Uri("http://localhost:8080/
singletone");

//Instantiate new ServiceHost
myServiceHost = new
ServiceHost(typeof(Singtetone.ISingletone), baseAddress);

//Open myServiceHost
myServiceHost.Open();
}

internal static void StopService()
{
//Call StopService from your shutdown logic (i.e. dispose
method)
if (myServiceHost.State != CommunicationState.Closed)
myServiceHost.Close();
}
}
}

Although i defined the endpoints for each , i got this error
message :

Service 'PerCall.PerCall1' has zero application (non-infrastructure)
endpoints. This might be because no configuration file was found for
your application, or because no service element matching the service
name could be found in the configuration file, or because no endpoints
were defined in the service element

Best Regards,
Hakan Fatih YILDIRIM
MCP
Dec 31 '07 #9

hi Nicholas,

Thanks for your efforts and faster replies. i solved the problem the
problem is simple and basic. i don't know that issue: service name =
<service namespace>.<service class. i gave a simple name for this.
so it didn't work.

Best Regards
Hakan Fatih YILDIRIM
MCP

Dec 31 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1026
by: Dan | last post by:
All, I have a Windows Service that is a hosting a Remote Object Server. The channels are configured via a Configuration File. Everything works fine but I noticed something. Regardless of what directory the service exe file is installed in the Config file has to be placed in the Win32 (on my Win2k server ) directory in order for the file to...
2
1858
by: Nitin Verma | last post by:
Hi All, Am new to web service technology. Currently i created a web service at my home box. Now i want to Host/Publish it to the outside world... so that it is used by my web applicantion as well as windows client applicantion. So my question is how to host/publish any web service ?? Any recommendations on Hosting companies which...
4
1524
by: Jay | last post by:
Sorry if posting this to the wrong group, but do you know of any asp.net hosting vendor with support for Crytal Reports? Apparently they do not exist due to high licensing costs at $25k per cpu. Certainly someone must be offering this? Thanks. -- Jay
0
1807
by: Kunal Pandya | last post by:
Windows Web Hosting @ $ 14.95 / Year! with FREE Domain Registration!!! + Web Control Panel + MIn. 5 Email Boxes + Packages starting from as low as 10 MB upto 50 GB dedicated hosting + Extra FREE space + ASP/.NET/Access et al. support + 24/7 Technical Support + Windows Server 2003 Hosting
5
2074
by: Scott | last post by:
Can anyone refer me to a good hosting provider? I'm looking for a reseller plan with PHP 5, MySql 5, 24 x 7 support, and most importantly, a solid uptime record. Customer referrals only, please. Thanks, Scott
1
1849
by: Diego L Espiñeira | last post by:
Hi all!!! I am trying to build a windows service that hosts a web service using the classes in System.Web.Hosting namespace. I have a class library called Digicard.WebServiceHost containing the code for hosting the web service and I've got a windows forms host (for debugging porposes) and a windows service host (the definitive exe). The issue...
3
1704
by: jonny | last post by:
Please recommend a Web Hosting Service that supports ASP.NET and SQL server. I am new at this and just signed up with Yahoo before I new any better. It appears that yahoo does not support ASP.NET and SQL server. (Instead yahoo offers PHP and MySQL) Also, good site to go and get a domain name. Thank you.
6
1250
by: Bob Altman | last post by:
This is a follow-on to my previous post. It occurs to me that I asked the wrong question. Here's what I'm really trying to accomplish: My application is a real-time airplane and avionics simulation. My application includes a .Net singleton, exposed via remoting, that allows clients to do things like starting, stopping, and resetting the...
1
2069
by: =?Utf-8?B?TWFuanJlZSBHYXJn?= | last post by:
Hi, I created a web service that I want to host in windows service. The problem is that if I host it as windows service it does not use the configuration file. I have to define the binding, endpoint etc. programmatically in the Program.cs file. Any idea what I might be doing wrong? Cheers,
4
3144
by: Dave Burns | last post by:
I am self hosting a Web Service in a Windows service. I am trying to start the service using the NT AUTHORITY\NetworkService account. I get a NullReferenceException on ServiceHost.Open() in the ServiceBase.OnStart() method. SCM throws a 1067 error as well. I get the same problem with NT AUTHORITY\LocalService. When I use the LocalSystem...
0
7182
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7581
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
5714
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5110
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4773
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3267
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
1624
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
825
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
488
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.