Tuesday, July 31, 2007

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

Sunday, July 29, 2007

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

Wednesday, July 25, 2007

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

Thursday, July 19, 2007

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

Tuesday, July 17, 2007

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

Monday, July 16, 2007

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

Deploy a windows service in VS 2005

Hi Folks,

Below article show how to develop/Debug and deploy a windows service.

http://aspalliance.com/1316_Working_with_Windows_Service_Using_Visual_Studio_2005#Page2


Hope this helps.


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

Tuesday, July 10, 2007

Recover SQL 2005 DB passwords

Hi Folks,

I got an urgent request of one of my friends asking for a solution to recover SQL 2005 DB passwords,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 SQL 2005 user accounts passwords ,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 SQL server 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.

In case you put the password on the bak file,then no way to do any kind of restore to this DB;see more on this article : http://mssqltips.com/tip.asp?tip=1108


Regards,
Moustafa arafa

Sunday, July 08, 2007

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

Monday, July 02, 2007

.Net 3.0 & .Net 2.0 Design Tips














On the above figure it shows the following:

1) New Technologies coming with .net 3.0 Framework (CF,WF,PF,CardSpace).

2) The Base of .Net Framework 3.0 working on the .Net Framework 2.0,this means any application on 2.0 will not have any interoperability issues or problem to work on .net 3.0 unlike the shift between .net 1.0 to 2.0.

3) Move from Web services to WCF :
-System.ServiceModel is the namespace which provides the whole funcaitonality of WCF.
-Implementing the interface and the implementaiton clsses to implement a WCF service.
(Service Contract,Operation Contract,DataContract)
- Binding information on the web.config,Transport protocol,Endpoints information.

- using svcUtil tool to create proxy classes and clients to your service.

-Integration with COM+,WS,MSMQ,.Net Remoting....etc with WCF







Thursday, June 28, 2007

4 Tenets of Service Orientation

Hi Folks,

This post is to show and describe the 4 tenets of SOA and how is it implemented in WCF Technology in a way,how can WCF to avoid the wellknown pitfalls of using current technologies such as (WSE):

1) Boundaries are explicit :
Applications is communicating to each other by sending and receiving messages to each other.

2) Services are autonomous: you can't control any service out of your organization boundaries.
Your solution should be loosly coupled ,so it can tolerate these changes and continue running if one or more services are un available.


3) Services share schema,contracts not classes or types: simply each service publish the schema of the data which will be exchanged between the service and clients and how can be binded to the clients,these information is used by clients to consume the published services.


4)Compatability is based on policy:Schemas and contracts exposed by the service is define the "Shape" of the service.

if you familiar with WS Enhancements,it has its specification on WS-Security,WS-Interoperability....etc which has been encapsulted into the WCF unified platform.


From Introducing WCF- MS Press

Regards,
Moustafa arafa

Tuesday, June 26, 2007

Deploy WSS 3.0 Web Part

Hi Folks,

This post i will explain how can you dpeloy a wss 3.0 webpart to your shareporint server.

the steps as follows:

1) on your class library,open project properties.
2) select signing tab.
3) check sign assembly check box and select new,and give your snk file a proper name , Close and save.

You will notice that a new snk file has been added to your solution which is used to sign your assembly and give it a strong name.

4) Dont forget to build the dll to be signed with the created strong file name.
5) add your strong name assemly to the GAC using VS command line

GacUtil -i MyAssembly.dll

You can check that the file assemly has been imported to GAC y navigating to :
C:\Windows\assembly

you will find your dll,this means that your string name dll has been imported successfully to GAC (Global Assembly Cache)

6) Right click on your srong name assembly and select properties,and copy the public token.

7) Create a manafiset file in your project "Manifest.xml"

8) Paste the public token you have saved to the PublickKeyToken attribute under safeControls element in Manifest.xml file.

9) Manifest.xml file should be Content file on the build action property on VS.

on the above steps,your web part is ready to be packaged up to the shareporint server,to create the cab file of this webpart do the following:

10) add a new project, Cab Project.
11) add the primary output / content files to the Cab Project.
12) Build the CaB Project.
13) after building the CAB Project,Rename it to wsp (SharePoint solution file).
14) Take this file (wsp) and insert it using SBS admin tools :
stsadmin -c addsolution -filename MyWebPartCab.wsp

15) On Solution Management on SharePoint Central administration site, you will see the imported solution file which oyu have did on the previous step.

16) Select the solution and click on Deploy Button.


Now you have finished deploying your webpart and you can add it to any web application in your WSS Sites.

Add our webpart to your site on any webpart page,if you didnt find it,add it by clicking on new button on the web parts gallery list.


Hope this helps and descriptive.

Regards,
Moustafa arafa

Monday, June 25, 2007

Gulf MVP Summit @ 21 June

Hi All,

This is a photo to me with Charbel Fakhoury (MS Gulf GM) during giving us our give aways on Closing session of Gulf MVP summit.

Thanks AMR (my MVP Lead) for this excellent photo.

I like this photo alot,and to see more,visit my personal space:
http://marafacs.spaces.live.com/






Sunday, June 24, 2007

Gulf MSDN Flash Newsletter Issue 1

Hi All,

Gulf MSDN Flash newsletter has been published issue #1,

http://www.microsoft.com/middleeast/msdn/newsletter/June%202007.htm

Check it and subscribe on it,and check my articles there.

Under MVPs section you will find my articles.

Regards,
Moustafa arafa

new community has been launched in Riyadh

Hi folks,

New Community has been launched in Riyadh called Mobarmij,for those who doesnt know what does "Mobarmij" means? it means Programmer and its an arabic word which is equivelant to Programmer in english.

I have introduced this community in Gulf MVP Summit in Dubai 21 June 07 In one of the summit sessions called "Coming soon with MVPs", and hope all success for its board members.

http://www.mobarmij.net/




Regards,
Moustafa arafa

Tuesday, June 19, 2007

Get Latest Version while Check Out on VS 2005

Hi Folks,

This post is to highlight one of the important thing you have to take care when you upgrade your Source Control System from VSS to TFS,one of the major changes between both products is Checkout action is different than its behavior on VSS.

On VSS,Check out action get Silent Get latest action on the same action.

On TFS,Check out doesnt get latest of your files.

This feature is not available on V1 of TFS & VS 2005 and this will be availble on Orcas.

As a Temporarily solution,you can download an add-In to do that for you,Get Latest while checkout your files in TFS........

AddIn Download Link :

http://www.codeplex.com/TfsAddInCheckOut


Hope this helps.














Regards,
Moustafa arafa

Monday, June 18, 2007

Project Server 2007 VSTS Connector

Hi Folks,

New Connector is available for TFS with Project Server 2007..... Try It now.

http://www.codeplex.com/pstfsconnector


Regards,
Moustafa arafa

Sunday, June 17, 2007

New AJAX Control ToolKit has been released

Hi Folks,

New Tool kit has been released with alot of enhancements and new controls as well,read more :

http://weblogs.asp.net/scottgu/archive/2007/06/08/new-asp-net-ajax-control-toolkit-release.aspx

Enjoy with AJAX :!

Regards,
Moustafa arafa

Wednesday, June 13, 2007

WSS sites Customization in TFS

Hi All,
If you want to customize the created portal over WSS installation,read this post on MSDN forums,its very useful to give your sites the same Look & Feel on your process documents template site.

read this post on MSDN Forums :
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1726035&SiteID=1&mode=1

Hope This Helps.

Regards,
Moustafa arafa