Click here to Skip to main content
15,848,451 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
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.

Sergey Alexandrovich Kryukov 30-May-11 4:12am    
Not enough information.

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.

  <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>

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 ...
Share this answer
Nitin_Verma 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:
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)

'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

'Step 5 of the hosting procedure: Start (and then stop) the service.
Catch ex As Exception
MsgBox("An instance of Indianet client is already running.")
End Try
End Sub

And It was working fine means no delay when it was in framework 3.5.
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

 <binding name="binaryHttpBinding">

Cheers ...
Share this answer
Nitin_Verma 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.

Nitin Verma

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

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900