TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Simon
NA
8
0
Problem with using service from process which started it...
Jul 11 2011 7:10 AM
Hi everyone,
I have a problem using callbacks and WCF.
I'm trying to write a service for message logging. Imagine several processes which want to write into one
"global" logfile. I have a project called "LogMessageServiceApplication". This is basically a WPF-Application
with an UI that displays all recently added messages. This application also starts the service in the background.
Using the service from other processes to write messages works fine.
But If I want to subscribe a callback from "LogMessageServiceApplication" the program freezes and crashes eventually.
Are there any restrictions with services from the process which actually started the service?
For better understanding see code snippet below
public
MainWindow()
{
InitializeComponent();
StartService();
SetCallback();
Hide();
}
private void
StartService()
{
string
serviceName =
"net.tcp://localhost:12500/dSPACELogMessageService"
;
serviceHostConnection =
new
ServiceHost
(
typeof
(
MessageService
),
new
Uri
(serviceName));
serviceHostConnection.Open();
// Starting the service here works fine
}
private void
SetCallback()
{
LogMessageServiceCallback
callback =
new
LogMessageServiceCallback
(_logHandler);
DuplexChannelFactory<ILogMessageService>
duplexChannelFactory =
new
DuplexChannelFactory<ILogMessageService>
(callback,
new
NetTcpBinding
(),
new
EndpointAddress
(
"net.tcp://localhost:12500/dSPACELogMessageService"
));
_proxy = duplexChannelFactory.CreateChannel();
_proxy.Subscribe();
// This is the line of code where the program freezes :-(
}
Is it forbidden to use the service from the process which started it ?
I appreciate any help or information.
Best Regards,
Simon
Reply
Answers (
1
)
How do I implement log throttling in WCF?
Expose WSDL from WCF Service Library