Click here to Skip to main content
15,868,026 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.

Regards,
Nitin
Posted
Comments
Sergey Alexandrovich Kryukov 30-May-11 4:12am    
Not enough information.
--SA

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.

XML
<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 ...
 
Share this answer
 
Comments
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:
<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.
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

XML
<customBinding>
 <binding name="binaryHttpBinding">
   <binaryMessageEncoding/>
   <httpTransport/>
 </binding>
</customBinding>



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

Regards,
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