Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: .NET3.5 WCF Framework security , +
Hi All,
 
In My winform application I have implemented self hosted WCF service accessible only on LAN.
 
Previously my app was in framework 3.5, now I have migrated to 4.0.

My application is ment to start on windows startup, and previously it was working fine.
 
After the migration from 3.5 to 4.0. It has started taking around 1.5 minutes to strart.
 
Do any of you have any Idea about this annoying delay.
 
Regards,
Nitin
Posted 29-May-11 21:57pm
Comments
SAKryukov at 30-May-11 4:12am
   
Not enough information.
--SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Please check with the app.config file with your application, the only delay might happen due to your config file, else there is nothing else to happen this kind of issue ...
 
Check if your config has been changes as per the change in framework
for e.g.
 
<startup>
  <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
 

Also check with the necessary bindings reflected properly in your config. or just delete your existing config and create new (Delete and updated the web references again)
 

Cheers ...
  Permalink  
Comments
Nitin_Verma at 30-May-11 4:46am
   
this startup tag is there in my config file.
 
the delay is being caused by the code which starts my wcf service, and not when consuming the service.
 
the code to start the service is below:
<pre>
Public Sub StartWCFServer()
'Step 1 of the address configuration procedure: Create a URI to serve as the base address.
Dim baseAddress As Uri = New Uri("http://localhost:8080/Indianet/ClientService")
 
'Step 2 of the hosting procedure: Create ServiceHost
Dim selfHost As New ServiceHost(GetType(WCFService), baseAddress)
 
Try
'Step 3 of the hosting procedure: Add a service endpoint.
selfHost.AddServiceEndpoint(GetType(IndianetContract.IServerManager), New WSHttpBinding(SecurityMode.None), "WCFService")
 
'Step 4 of the hosting procedure: Enable metadata exchange.
Dim smb As New ServiceMetadataBehavior()
smb.HttpGetEnabled = True
selfHost.Description.Behaviors.Add(smb)
 
'Step 5 of the hosting procedure: Start (and then stop) the service.
selfHost.Open()
Catch ex As Exception
selfHost.Abort()
MsgBox("An instance of Indianet client is already running.")
Application.Exit()
End Try
End Sub
</pre>
 
And It was working fine means no delay when it was in framework 3.5.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

framework 4 introduced the binaryHttpBinding, which is helping the transfer the data faster across internet .. you can try this as well ..
 
you need to change the default binding (wsHttpBinding) to custom binding as binaryHttpBinding
 
<customBinding>
 <binding name="binaryHttpBinding">
   <binaryMessageEncoding/>
   <httpTransport/>
 </binding>
</customBinding>
 

Cheers ...
  Permalink  
Comments
Nitin_Verma at 30-May-11 6:19am
   
Yogesh thanks for replying,
 
I actually dont have performance issue.
My problem is slow startup of service only on boot time.
and that to only in framework 4.0.
 
Regards,
Nitin Verma

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web01 | 2.8.140709.1 | Last Updated 30 May 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid