I'm newbie to WCF so i started by playing with "Hello World" sample
Everything works great except last step (Securing Communication Between the Client and Server) When i change binding to WSHttpBinding and run app (server then client), messages are sended ok, client ends but server hangs on HService.Close(); After a while, System.TimeoutException is thrown :
System.TimeoutException was unhandled
Message="Unable to claim lock within the given timeout."
Source="System.ServiceModel"
StackTrace:
at System.ServiceModel.Channels.ThreadNeutralSemaphore.Enter(TimeSpan timeout)
at System.ServiceModel.Security.SecuritySessionServerSettings.ServerSecuritySessionChannel.TryReceiveRequest(TimeSpan timeout, IRequestContext& requestContext)
at System.ServiceModel.Security.SecuritySessionServerSettings.ServerSecuritySessionChannel.TryReceive(TimeSpan timeout, Message& message)
at System.ServiceModel.Security.SecuritySessionServerSettings.ServerSecuritySimplexSessionChannel.WaitForShutdown(TimeSpan timeout)
at System.ServiceModel.Security.SecuritySessionServerSettings.ServerSecuritySimplexSessionChannel.OnClose(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Close(TimeSpan timeout)
at System.ServiceModel.Channels.ChannelManagerBase.CloseChannels(TimeSpan timeout)
at System.ServiceModel.Channels.SecurityChannelListener`1.OnClose(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Close(TimeSpan timeout)
at System.ServiceModel.Channels.ChannelListenerBase.OnClose(TimeSpan timeout)
at System.ServiceModel.Channels.DelegatingChannelListener`1.OnClose(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Close(TimeSpan timeout)
at System.ServiceModel.BindingListener.OnClose(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Close(TimeSpan timeout)
at System.ServiceModel.BindingManager.OnClose(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Close(TimeSpan timeout)
at System.ServiceModel.ServiceHostBase.OnClose(TimeSpan timeout)
at System.ServiceModel.ServiceHost.OnClose(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Close(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Close()
at HelloService.Server.Main(String[] args) in C:\Documents and Settings\Liwoj.MEDIARESEARCH\My Documents\Visual Studio 2005\Projects\IndigoTest\Server\Server.cs:line 21
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
Using VS.NET 2005 RTM, WinXP En SP2, WinFX January CTP
Are there any prerequisities for using wsHttpBinding (for example WSE installed) I ques not .
Thanx

System.TimeoutException in "Hello World" sample
BlogusMaximus
CosmicSheep
John Colaizzi
Javafun
please install Feb ctp,so you can play with recent bits
-Thank you
Madhu
Drakx
Jobs
in jan ctp,in some cases,wcf runtime didn't report error,it waits for some time and then we get timeout exception.
please install feb ctp,it is billion times better than Jan ctp
http://blogs.msdn.com/madhuponduru/archive/2006/02/22/537622.aspx
I am thinking may be mis matching binding causing this problem,can you please make sure you changed binding in both client and server
//when you are adding binding programmatically,we don't need config on server side
My service code:
using System;
using System.Collections.Generic;
using System.Text;
using System.ServiceModel;
namespace HelloService
{
class Program
{
static void Main(string[] args)
{
Uri baseURI = new Uri("http://localhost/hello");
ServiceHost HService = new
ServiceHost(typeof(HelloService), baseURI);
HService.AddServiceEndpoint(typeof(HelloService),
new WSHttpBinding(), baseURI);
HService.Open();
Console.WriteLine("Service at your service.");
Console.ReadKey();
HService.Close();
}
}
[ServiceContract]
class HelloService
{
[OperationContract]
string sayHi()
{
return ("Hi!");
}
}
}
client code:
using System;
using System.Collections.Generic;
using System.Text;
using System.ServiceModel;
using clientapp.localhost;
namespace HelloClient
{
class Program
{
static void Main(string[] args)
{
HelloServiceProxy p = new HelloServiceProxy();
Console.WriteLine(p.sayHi());
Console.ReadKey();
}
}
}
client config:
< xml version="1.0" encoding="utf-8" >
<configuration>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_HelloService" bypassProxyOnLocal="false"
transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Message">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
establishSecurityContext="true" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost/hello" binding="wsHttpBinding"
bindingConfiguration="WSHttpBinding_HelloService" contract="clientapp.localhost.HelloService"
name="WSHttpBinding_HelloService" />
</client>
</system.serviceModel>
</configuration>
MORE INFO;
SDK smaples is best resource to learn more about wcf
http://windowssdk.msdn.microsoft.com/library/default.asp url=/library/en-us/WCF_samples/html/d6a47b3e-75c7-45c6-88ea-658868276669.asp
we have wcf seminars here
http://windowscommunication.net/default.aspx tabindex=3&tabid=45
-Thank you
Madhu
Ran-Solo
//If you close the proxy after you are done with the call,everything will be ok(client side)
HelloServiceProxy p = new HelloServiceProxy();
Console.WriteLine(p.sayHi());
p.Close();
Console.ReadKey();
//If service host thinks,it has any active client connections,it has problem closing the service host,I am not sure this bug or by design,we will try to debug it
//Feb ctp giving better error message
Unhandled Exception: System.TimeoutException: The service's security session did
not receive a 'close' message from the client within the configured time.
at System.ServiceModel.Security.SecuritySessionServerSettings.ServerSecurityS
implexSessionChannel.OnClose(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Close(TimeSpan timeout)
at System.ServiceModel.Channels.ChannelManagerBase.CloseChannels(TimeSpan tim
eout)
at System.ServiceModel.Channels.SecurityChannelListener`1.OnClose(TimeSpan ti
meout)
at System.ServiceModel.Channels.CommunicationObject.Close(TimeSpan timeout)
at System.ServiceModel.Channels.ChannelListenerBase.OnClose(TimeSpan timeout)
at System.ServiceModel.Channels.DelegatingChannelListener`1.OnClose(TimeSpan
timeout)
at System.ServiceModel.Channels.CommunicationObject.Close(TimeSpan timeout)
at System.ServiceModel.Dispatcher.ChannelDispatcher.OnClose(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Close(TimeSpan timeout)
at System.ServiceModel.ServiceHostBase.OnClose(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Close(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Close()
at HelloService.Program.Main(String[] args) in C:\Documents and Settings\madh
-Thank you
Madhu
rkcarroll
WCF is no diferent from the rest of .NET:
IDisposable has absolutely nothing to do with garbage collection. It is up to you to call it, and there is no magic that does it for you.
Thanks,
Juval Lowy IDesign Inc.