Managing your WCF Service Context & State

Hi Folks,

when you create a host for your service,this host manage the context of the service and its states,for this reason,you have to take care how can you configure your host to keep your service under control without any issues regarding the security or performance.

One point regarding the Service performance which is the Service Context:did u ask your self if 1000 Clients call your service ? how manay instances will be created from your service ?

To answer this question,you have to know which mode are your setting your service to work with.

1) Per Session Mode :

How to Implement : Mark your service class with this attribute

C# : [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession)]

Answer : 1000 sessions will be created.

2) Per Call Mode :

How to Implement : Mark your service class with this attribute

C# : [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]

Answer : Per call the host will create an instance for your service.
This mode give better performance incase the client still opened and not active rather than the prev. mode.

3) Single Mode :

How to Implement : Mark your service class with this attribute

C# : [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]


Answer : 1 instance and all clients can share data between them.

Hope this helps.


Regards,
Moustafa arafa

Breaking and Non-Breaking change on WCF service

Hi Folks,

In this post i want to mention and differentiate between 2 types of changes on any WCF service.

when you are developing a wcf servive,the changes might occur,and before any change you have to test and examine does this change will affect the service clients ?

The changes you have done on a WCF Service,it will affect the client anyway,but the type of the change it might break the client which yield to the client will not work OR it might yield to the client can continues working in a healthy way.

NON Breaking Changes:
Implicit or Explict security checks,change on the logic of the function,add extra binding configuration…etc

Breaking Changes:
Change Method paramaters , Add new paramaeters,change return types,delete methods.

Any Change which will break the client,you have to inform the client owner with the change you have done,to keep the client working.

Hope this helps.


Regards,
Moustafa arafa

Monitor your WCF Services

Hi Folks,

if you are a WCF Developer / Analyst,and you want to trace all messages between your WCF Services and theri clients,MS Provide a tool to monitor and trace all SOAP Messages between the services and its clients called “Service Trace Viewer”

TO Open Service Trace Viewer Tool :

C:\Program Files\Microsoft SDKs\Windows\v6.0\Bin), and then type SvcTraceViewer.exe.

Files Supported by this tool :
**WCF Tracing File (.svcLog) -> this will be used for tracing purposes on your WCF Apps.

**Event Tracing File (.etl)
**Crimson Tracing File


Read more on Service Trace Viewer :
http://msdn2.microsoft.com/en-us/library/ms732023.aspx


Regards,
Moustafa arafa

New SDKs : WSS 3.0 SDK & MOSS 2007 SDK

Hi Folks,

New SDKs has been released for SBS 2007 and for WSS 3.0.

Download link :

SBS 2007 SDK :
http://www.microsoft.com/downloads/details.aspx?FamilyID=6d94e307-67d9-41ac-b2d6-0074d6286fa9&displaylang=en

WSS 3.0 SDK :
http://www.microsoft.com/downloads/details.aspx?FamilyID=05e0dd12-8394-402b-8936-a07fe8afaffd&displaylang=en

Enjoy!


Regards,
Moustafa arafa

Top 10 Gems in SQL 2005

Hi All,

Excellent article which highlight some features on SQL 2005 which weren’t get the spot on the webcasts,articles and SQL Demos.

http://www.microsoft.com/technet/prodtechnol/sql/bestpractice/gems-top-10.mspx

Thanks my Friend ali Riza for his useful post.
http://www.dotnetking.com/TechnicalComments.aspx?LogID=299

Hope this helps………. :)

Regards,
Moustafa arafa

Bug on VS 2005 on installing the default installer

Hi Folks,

if you create your windows service,and u add the project deployment package and you try to install it from the VS.Net by right click on the deployment packge and install,this will not show the service in the services list on windows,even the installer says the service has been successfully installed.

the only thing u can do to install your service in the services in windows,run this command :

installutil YOUR_SERVICE_NAME_PATH.

this will show the service on the services list.

Hope this help.

service
Regards,
Moustafa arafa

Mid function in VB.net for C# Guys

Hi C# Devs,

I want to convert one of the vb.net code functions to a c# solution for some requirments ,i found on the code the usage of Mid function as one of the important functions on the string manipulation for vb.net developers; as a C# guy,i need an equivelant to it,simply replace the mid function with the following :

VB.Net :
str2= Mid(str1, 1, Len(str1) – 1)
C# :
str2=str1.substring(1);


substring function is the equivelant to Left,Right,Mid functions for VB.Net developers.

VIVA C#……………… :)


Regards,
Moustafa arafa

Recover SQL 2005 DB passwords

Hi Folks,

I got an urgent request of one of my firends asking for a solution to recover SQL 2005 DB password,the situation was as follows:

He took a backup of SQL 2005 DB and set the password option on SQL 2005,and when he tried to restore the DB,SQL 2005 request the password which he forgot it.

My First question was: did he protect the bak file from SQL 2005 or not ? after i got that he protect the DB from SQL 2005,i started to search for third party solution to fix this problem since this DB contains very sensitive information.

I found a third party to recover the DB password for SQL 2005,try it now :
http://www.safe-install.com/programs/sql-password.html

The security hole which i discovered that this program can’t recover the DB passwords if the SQL Engine was configured to use only Windows Authentication Mode; and this is considered as an important security point when we use MS Products with Windows Authentication mode ONLY.

From this post,you have to take care of your SQL installation which mode is an appropriate to your organization.
Hope this helps.





Regards,
Moustafa arafa

Protecting your WCF Service

Hi Folks,

.Net Framework built a robust framework for building distributed application by providing different security means to protect your WCF Service.

you can protect your WCF Service by 3 different ways which is most requested for all different kind of applications :

1) Windows Role Token group based on Active Directory Group.
2) SQL Role Provider: user roles stroed in a DB.
3) Authorization Role Provider : using MS Authorization manager tool.
** This tool let you store the roles in the AD or XML file.

Happy .netting.



Regards,
Moustafa arafa