Pages






Monday, February 28, 2011

LINQ Tutorial with Dot Net Framework 3.0 and 3.5

With the advancement of technologies and database it has become a great challenge to retrieve data faster and with less burden on programming part.

It has become apparent that the next big challenge in programming technology is to cut the complexity of accessing and integrating information that is not natively defined using OO technology. The two most common sources of non-OO information are relational databases and XML.

The major advantage of Microsoft’s LINQ Project is the general approach they have taken because they have integrated a query language irrespective of any specific part.Language Integrated Query can be used with XML,Database or anything which is capable of returning IENUMERABLE.

Here is a small tutorial that can explaining. This is specially for my readers who love to do to programming.

This is a snippet which I found in the document itself which can express the power of LINQ and make programmers of dot net really smile.

using System; using System.Query;
using System.Collections.Generic;
class app {
static void Main() {
string[] names = { “Burke”, “Connor”, “Frank”,“Everett”, “Albert”, “George”,”Harris”, “David” };

IEnumerable expr = from s in names
where ( s.Length == 5 orderby s )
select s.ToUpper();
foreach (string item in expr)
Console.WriteLine(item);

}

}

How Linq works with XML ?

The extensibility of the query architecture is used in the LINQ project itself to give implementations that work over both XML and SQL data.

Xpath and Xquery which is used heavily is in the host programming language. Here is again a code snippet for showing how easy it is to work with LINQX(yes that’s what its called for XML’s)

The Standard way is done as follows:

XmlDocument doc = new XmlDocument();
XmlElement name = doc.CreateElement(“name”);
name.InnerText = “Patrick Hines”;
XmlElement phone1 = doc.CreateElement(“phone”);
phone1.SetAttribute(“type”, “home”);
XmlElement phone2 = doc.CreateElement(“phone”);
phone2.SetAttribute(“type”, “work”);
XmlElement street1 = doc.CreateElement(“street1″);
XmlElement city = doc.CreateElement(“city”);
city.InnerText = “Mercer Island”;
XmlElement state = doc.CreateElement(“state”);
state.InnerText = “WA”;
XmlElement postal = doc.CreateElement(“postal”);
postal.InnerText = “68042″;
XmlElement address = doc.CreateElement(“address”);
address.AppendChild(street1);
address.AppendChild(city);
address.AppendChild(state);
address.AppendChild(postal);
XmlElement contact = doc.CreateElement(“contact”);
contact.AppendChild(name);
contact.AppendChild(phone1);
contact.AppendChild(phone2);
contact.AppendChild(address);
XmlElement contacts = doc.CreateElement(“contacts”);
contacts.AppendChild(contact);
doc.AppendChild(contacts);

If we see it little closer the above code , This style of coding provides few clues to the structure of the XML tree. but with LINQX it becomes more of what they as functional construct.Here is what how u code the same with LINQX….

XElement contacts = new XElement
(“contacts”,new XElement(“contact”,
new XElement(“name”, “Patrick Hines”),
new XElement(“phone”, “206-555-0144″,
new XAttribute(“type”, “home”))
,new XElement(“phone”, “425-555-0145″,new XAttribute(“type”, “work”)),
new XElement(“address”,new XElement(“street1″, “123 Main t”),
new XElement(“city”, “Mercer Island”),
new XElement(“state”, “WA”),new XElement(“postal”,”6843″)

This is so simple no hassles at all.
How LINQ works with database

Yup its done By Microsoft again under LINQD(thats LINQ for database). The query operators over relational data (DLinq) build on the integration of SQL-based schema definitions into the CLR type system.

This integration provides strong typing over relational data while retaining the expressive power of the relational model and the performance of query evaluation directly in the underlying store.

What we kneed to know is the structure of database table we want to deal with it and create a class exactly having private variables as columns of the underlying table say may be like save that easy.Thus in simple way we create an object of the row of that table in memory and do operation on that and ask somebody to save it.Moreover we can ask for a collection of those rows fo get more than one record and do a query on it..isnt that great no hassles of database sql.

1. Create an entity class with mapping to database table like this:-

[Table(Name="Customers")]
public class Customer
{
[Column (Id=true)]
public string CustomerID;
private string _City;
[Column(Storage = "_City")]
public string City
{
get { return this._City; }
set { this._City = value; }}}

2.Create a Data context to load from database

static void Main(string[] args){
// Use a standard connection string
DataContext db = new DataContext(
@”C:Program FilesLINQ PreviewDatanorthwnd.mdf”);
// Get a typed table to run queries
Table Customers = db.GetTable();

3.Query what you get….

// Attach the log showing generated SQL to console
// This is only for debugging / understanding the working of DLinq
db.Log = Console.Out;
// Query for customers in London
var custs =
from c in Customers
where c.City == “London”
select c;
}

Thats how it works with database….easy isn’t it…This Technology will come with DotNet Framework 3.0 and with C#3.0 and VB 9. I havent covered every thing but just a quick glance which can get grasping things faster. If you want to read more on it see the Microsoft’s LINQ Project

SOURCE:http://www.technospot.net/blogs/linq-tutorial-with-dot-net-framework-30/

Namespace in Dot Net Framework

Namespace means all the libraries ,properties and events are included in Framework.

System: All the basic types used by every application.

System.Collections: Managing collections of objects. Includes the popular collection types such as Stacks, Queues, Hashtables, and so on.

System.Diagnostics: Instrumenting and debugging your application.

System.Drawing: Manipulating 2D graphics. Typically used for Windows Forms applications and for creating images that are to appear in a web form.

System.EnterpriseServices: Managing transactions, queued components, object pooling, just-in-time activation, security, and other features to make the use of managed code more efficient on the server.

System.Globalization: National Language Support (NLS), such as string compares, formatting,and calendars.

System.IO: Doing stream I/O, walking directories and files.

System.Management: Managing other computers in the enterprise via WMI.

System.Net: Network communications.

System.Reflection: Inspecting metadata and late binding to types and their members.

System.Resources : Manipulating external data resources.

System.Runtime.InteropServices: Enabling managed code to access unmanaged OS platform facilities, such as COM components and functions in Win32 DLLs.

System.Runtime.Remoting: Accessing types remotely.

System.Runtime.Serialization: Enabling instances of objects to be persisted and regenerated from a stream.

System.Security : Protecting data and resources.

System.Text: Working with text in different encodings, like ASCII or Unicode.

System.Threading : Performing asynchronous operations and synchronizing access to resources.

System.Xml : Processing XML schemas and data.

System.Web.Services : Building web services.

System.Web.UI : Building web forms.

System.Windows.Forms: Building Windows GUI applications.

System.ServiceProcess : Building a Windows service controllable by the Service Control Manager.

http://www.dotnetspider.com/resources/30357-Namespace-Dot-Net-Framework.aspx

Private and Share Assembly

In this article, i have tried to explain the difference between Private and Shared Assembly. I have also tried to give the steps to create such assemblies.

Introduction


An assembly is a compiled code library in .NET Framework. It is a logical unit of code.


Types of Assemblies


Assemblies are of two types.
  1. Private Assemblies
  2. Shared Assemblies

Private Assemblies


Assemblies which are used by single application are called "Private Assemblies". In this case, the bin\Debug\*.dll gets copied in the folder, in which the client application is present.
Let me cite an example here.

Start->All Programs->MS VS 2008->MS VS 2008->File->New->Project->ClassLibrary





I have named it as HappyNewYear. The code follows here:




Now it is the time to compile. So click at Build->Build Solution.
With this, HappyNewYear.dll is created at C:\HappyNewYear\HappyNewYear\bin\Debug




We have to use our .dll file in new ConsoleApplication. So create a new ConsoleApplication. It is named as UseOfDll.




Right Click on Solution Explorer->Add Reference->

With this Add Reference Dialog box open. From here, we have to browse our respective .dll file and press OK button.




Now, Solution Explorer shows, that .dll file is being added under References. We have used the HappyNewYear namespace.




Let me run the program and get the output.




Here using Private Assembly, .dll gets copied in the client application folder.



Shared Assemblies


Shared Assemblies are kept in Global Assembly Cache. Client application using Shared Assemblies need not have its own copy of dll. Shared Assemblies are present in C:\WINDOWS\assembly folder.

Steps to create Shared Assembly:

1. Create a .dll file. (Here i am using my existing HappyNewYear.dll)
2. Now let me create unique assembly name using SN utility(Shared Name utility).
The syntax for it is: sn -k filename.snk

Here sn stands for strong name, -k stands for key and key is stored in filename.snk .



Key pair is created now. The following figure shows the strong name key pair is created.





3. Sign the .dll with the private key by modifying AssemblyInfo file.

AssemblyInfo.cs file is present under Properties in the Solution Explorer. Here i have to give the path of the HappyNewYear.snk file.

[assembly: AssemblyKeyFile("C:\\HappyNewYear\\HappyNewYear\\HappyNewYear.snk")]






4. Compile the dll again to get the assembly signed.

5. And at last, place the dll in Global Assembly Cache(GAC). For that we have a gacutil.exe tool. The syntax is:
gacutil /i assemblypath

/i option installs an assembly into the Global Assembly Cache.



Now let's have a look on our Shared Assembly named "HappyNewYear" present in C:\Windows\Assembly folder.



Let me use this Shared Assembly in one application.




Here no copy of dll is created within the Debug folder of the application.








SOURCE:http://www.dotnetfunda.com/articles/article1117-private-and-share-assembly-.aspx

Dot Net Framework – A Comfort for Asp Net Application Development

Dot Net Framework – A Comfort for Asp Net Application Development

Computer started changing the world just after it got into use. Today computer industry cannot be defined using words due to its vast use in large range of field. Every component is important either its hardware or software. Software development is more dynamic and growing field with great prospect in future. Microsoft is largest software company in the world. Microsoft has delivered large range of products in the market from Operating System for desktop to mobile, software for desktop to large servers and many more. Microsoft is continually working with dedicated and highly professional developers to develop efficient and cross platform product both for user and developer. Dot net application development is one such cross platform framework and asp.net application is vastly in use all around the world for web application development.

Platform independent products are the main focused area for Microsoft to compete in this competitive environment. .NET from Microsoft is one such environment which gives programmer piece of mind about the compatibility issues either it is related to hardware or software. .NET environment is based on Common Language Runtime (CLR). In reality this is a collection of various technology and its development tools. Basically in past it was used for web based development. But in present .NET framework is use for large variety of application development.

Large collection of library in .NET provides great flexibility to implement his or her imagination with any programming language. It gives you an option to develop either non-GUI or GUI program very easily. Using asp.net programming web based application can also be developed which use XML base services.

Many companies in India are involved in the development of asp.net applications based projects. ASP.NET projects from all around the globe are outsourced to Indian company. Mainly Indian company charges their client on the per hour basis or project specification basis. Some time client hires complete team in India and makes payment on the monthly basis. These types of projects are of high costing and long term running projects.

Rapidsoft Technologies is one of the well recognized companies in India for the dot net application development framework. It has got well experienced team for asp.net application development. Rapidsoft's got great record of timely completion of projects according to the scope of work. It is consistently maintaining international quality of standard at competitive price.

http://www.articlesbase.com/programming-articles/dot-net-framework-a-comfort-for-asp-net-application-development-3977140.html

The Advantages of the .NET Framework

The .NET framework (DotNet)is a new Microsoft initiative directed to the modification of computer world. More specifically, it is a large set of development tools, servers, software, and services. Its main advantages for the user are creation of an integrated information space connecting him or her with computers and programs, as well as connection software applications together. For developers, the value of dotNet lies in interoperability and the seamless connectivity of multiple systems and sources of data. This empowers them to quickly and easily create required products.

The IT department manager of every company has a dream -- an enterprise that performs all business transactions with partners exceptionally over the Internet, with no headaches about the business processes. For this to happen, the processes must be well designed, stable, and easily customized and controlled both from the local network and from any computer in the Internet. All company's employees should have general access to work information, Email and personal documents no matter if they use mobile phone, Pocket PC, Notebook or high-end workstation.

Nowadays, in an age of rapid development of E-commerce, the existing tools for creating digital marketplaces do not always handle the business needs. By developing the new means for this field a major breakthrough belongs to XML Web services. For a long period of time there were used by program engineering services provided by external software. When it became clear that it is easier to once create a universal information storage facility and to integrate it into different programs than invent each time a new one, there appeared first Database Management Systems. Next step was the creation of messaging and collaboration systems, e.g. Lotus Notes and Exchange, which simultaneously served as development platforms. Then came into use the products providing messages delivery (Message Oriented Middleware), such as IBM MQSeries and MSMQ. They allowed to organize message exchange in distributed system with manifold (and often unreliable) communication links. Their difference from mail servers lied in the fact that they were oriented on information exchange not between people but various parts of program systems. Finally, one of the last tendencies became Application Servers and Enterprise Application Integration Servers. First ones allow to create scalable solutions of simple software components giving them a ready means of supporting distributed transactions, controlling access to total resources (particularly, connection with database) etc. Enterprise Application Integration Server acts as a glue, being the intermediate among existing program systems and helping them to process data and exchange references. Web services enhance and extend the value of these existing technologies. Theh alow an object's methods to be called over the Internet via HTTP. As a result, programs written in any language, and running on any operating system, can access .NET applications implemented as web services. By introducing a common, well-known standards of interaction between software, Web service technology allows for the creation intercorporate information systems without protracted coordination of proprietary interfaces. In addition, the use of HTTP as the transport mechanism will allow remote calls to these services to pass through corporate firewalls without compromising security. Web services existed before .NET was introduced, but the .NET framework makes creation of web services far easier than they otherwise would be.

Breaking down the distinctions between the Internet, standalone applications, and computing devices of every kind, Web services provide businesses with the opportunity to collaborate and to offer an unprecedented range of integrated and customized solutions - solutions that enable their customers to act on information any time, any place and on any device.

DotNet technology offers other far-reaching benefits for IT professionals. It enables programmers to develop powerful information systems using all capabilities of modern computers and networks without implementing helper functions implementation -- almost all of these functions are subsumed into the platform). It allows to concentrate only on the business logic of the product. Thus developers will be able to quickly create high-quality (and easy!) programs with a multitude of Internet integrated capabilities while reducing costs.

Built on XML Web service standards Microsoft .NET-connected software enables both new and existing applications to connect with software and services across platforms, applications, and programming languages. DotNet is already shifting the focus from individual Web sites or devices connected to the Internet to constellations of computers, devices, and services that work together to deliver more comprehensive programs.

http://www.freevbcode.com/ShowCode.asp?ID=5302

Dot Net Framework - A Comfort for Asp Net Application Development

Computer started changing the world just after it got into use. Today computer industry cannot be defined using words due to its vast use in large range of field. Every component is important either its hardware or software. Software development is more dynamic and growing field with great prospect in future. Microsoft is largest software company in the world. Microsoft has delivered large range of products in the market from Operating System for desktop to mobile, software for desktop to large servers and many more. Microsoft is continually working with dedicated and highly professional developers to develop efficient and cross platform product both for user and developer. Dot net application development is one such cross platform framework and asp.net application is vastly in use all around the world for web application development.

Platform independent products are the main focused area for Microsoft to compete in this competitive environment..NET from Microsoft is one such environment which gives programmer piece of mind about the compatibility issues either it is related to hardware or software..NET environment is based on Common Language Runtime (CLR). In reality this is a collection of various technology and its development tools. Basically in past it was used for web based development. But in present.NET framework is use for large variety of application development.

Large collection of library in.NET provides great flexibility to implement his or her imagination with any programming language. It gives you an option to develop either non-GUI or GUI program very easily. Using asp.net programming web based application can also be developed which use XML base services.

Many companies in India are involved in the development of asp.net applications based projects. ASP.NET projects from all around the globe are outsourced to Indian company. Mainly Indian company charges their client on the per hour basis or project specification basis. Some time client hires complete team in India and makes payment on the monthly basis. These types of projects are of high costing and long term running projects.

Rapidsoft Technologies is one of the well recognized companies in India for the dot net application development framework. It has got well experienced team for asp.net application development. Rapidsoft's got great record of timely completion of projects according to the scope of work. It is consistently maintaining international quality of standard at competitive price.


source:http://ezinearticles.com/?Dot-Net-Framework---A-Comfort-for-Asp-Net-Application-Development&id=5663282

Sunday, February 20, 2011

.Net practice

Our .NET Practice is a potent combination of skilled professionals, strong methodologies, sound business technology understanding and learning grounded in experience.
A solution built on Microsoft .Net technologies helps you integrate web-based and client server applications, allowing businesses to collaborate seamlessly. This gives you, your customers and your business partners the ability to access and act upon information any time, any place and on any device.
Microsoft .NET can bring considerable advantages to your business technology solutions – rapid and seamless integration, fast development cycles, lower TCO, greater efficiencies and an assured ROI.



View Technology
The .NET Practice professionals at IDEATION had worked closely with the .NET platform and Visual Studio .NET from its inception and has the experience and expertise to:

* Analyze client requirements and recommend a .NET business technology solution
* Architect your .NET solutions to meet your current and future requirements
* Build world-class .NET solutions that are cost effective and offer measurable ROI
* Migrate your existing application to .NET with the least possible disruption to your business
* Integrate new functionality or extend the functionality of your existing application using .NET technologies
* Train your development team on .NET technologies and provide valuable consultancy and best practices in .NET
* Support and Maintain your Mission Critical applications



Architecture Diagram



Technical Expertise
Integrated e-Business Solutions
Application Integration Enterprise Application Integration (EAI) and Business to Business application integration (B2B) using BizTalk Server
E-Commerce & Integration Servers Microsoft Commerce Server, Microsoft Content Management Server, Microsoft Host Integration Server

Advanced Infrastructure Solutions
Communication & Collaboration Servers Windows SharePoint Services, Microsoft Exchange Server, Active Directory Service (ADS), Microsoft SharePoint Portal, Lotus Domino Server.
Technology Active Directory Service Interfaces (ADSI), XML Web Services, ASP.Net
RDBMS SQL Server 2005, SQL Server 2000, Oracle, PostgreSQL, MySQL
OS Windows XP, Windows 2000 Server family, Windows 2003 Server family, Linux

Business Intelligence Solutions
Data Warehouse Data Modeling, Reporting Solutions, Data Migration and DTS
Database Servers SQL Server 2000, SQL Server 2005
Deployment Scripting InstallShield Scripting, Windows Installer Scripting

Standard Web / Windows Applications
Technology ASP.Net, ASP
Languages VB.Net, C#, VB6, VC++6, Visual Basic for Applications
Component Frameworks .Net, Mono (Linux version of .Net framework), COM/DCOM, ActiveX
Database Servers SQL Server 2005,SQL Server 2000, Oracle, PostgreSQL, MySQL
Deployment Scripting InstallShield Scripting, Windows Installer Scripting

Hosting WCF service over net.tcp protocol in IIS7 (WAS)

There are several articles showing how to host non-http protocols on IIS7. Some steps are like black box while others could easily be misconfigured.

The tasks is complicated additionally by obscured error messages returned in the browser :)

So let’s started (the example below is in Windows Server 2008. In Vista/Windows7 is similar but not exactly same):

Phase 1: Prepare server (prerequisites)

1. Add Web Server Role

  • Select following features as a minimum:
  • Common HTTP Features - all
  • Application Development
  • ASP.NET
  • .NET Extensibility
  • ISAPI extensions
  • ISAPI Filters
  • Security – all

2. Add Application Role

Add Application Server role and select all features (confirm all dependencies):

image

With this Phase 1 is complete. We should be able to navigate to Internet Information Services (IIS) Manage console in Administrative tools.

Phase 2: Deploying WCF application

1. Build WCF application with netTcpBinding :) (kindda obvious). For service endpoints leave address relative or empty.

   1: <services>
   2:   <service name="Microsoft.Test.Service" behaviorConfiguration="Service.ServiceBehavior">
   3:     
   4:     <endpoint name="netTcp" address="" binding="netTcpBinding" bindingConfiguration="bigMessages" contract="Microsoft.Test.IService" />
   5:     <endpoint name="mexNetTcp" address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>
   6:   service>
   7: services>

2. Create website that will host it in IIS

Since it is not a challenge to create it via IIS Manager here is how it can be achieved via script (JS). This can be used as custom action in WiX/MSI as well

   1: var adminManager = new ActiveXObject('Microsoft.ApplicationHost.WritableAdminManager');
   2: adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST";
   3:  
   4: var sitesSection = adminManager.GetAdminSection("system.applicationHost/sites", "MACHINE/WEBROOT/APPHOST");
   5:  
   6: var sitesCollection = sitesSection.Collection;
   7:  
   8: var siteElement = sitesCollection.CreateNewElement("site");
   9: siteElement.Properties.Item("name").Value = "WcfNetTcp";
  10: siteElement.Properties.Item("id").Value = 7;
  11:  
  12: var bindingsCollection = siteElement.ChildElements.Item("bindings").Collection;
  13:  
  14: var bindingElement = bindingsCollection.CreateNewElement("binding");
  15: bindingElement.Properties.Item("protocol").Value = "http";
  16: bindingElement.Properties.Item("bindingInformation").Value = "*:80:";
  17: bindingsCollection.AddElement(bindingElement);
  18:  
  19: var siteCollection = siteElement.Collection;
  20:  
  21: var applicationElement = siteCollection.CreateNewElement("application");
  22: applicationElement.Properties.Item("path").Value = "D:\\Hosting\\WcfApp";
  23: applicationElement.Properties.Item("applicationPool").Value = "DefaultAppPool";
  24: siteCollection.AddElement(applicationElement);
  25:  
  26: sitesCollection.AddElement(siteElement);
  27:  
  28: adminManager.CommitChanges();
  29:  

3. Add net.tcp protocol:

Here is how it should look from GUI:

image

And the script for it

   1: var adminManager = new ActiveXObject('Microsoft.ApplicationHost.WritableAdminManager');
   2: adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST";
   3:  
   4: var sitesSection = adminManager.GetAdminSection("system.applicationHost/sites", "MACHINE/WEBROOT/APPHOST");
   5:  
   6: var sitesCollection = sitesSection.Collection;
   7:  
   8: var siteElementPos = FindElement(sitesCollection, "site", ["name", "WcfNetTcp"]);
   9: if (siteElementPos == -1) throw "Element not found!";
  10: var siteElement = sitesCollection.Item(siteElementPos);
  11:  
  12:  
  13: var bindingsCollection = siteElement.ChildElements.Item("bindings").Collection;
  14:  
  15: var bindingElement = bindingsCollection.CreateNewElement("binding");
  16: bindingElement.Properties.Item("protocol").Value = "net.tcp";
  17: bindingElement.Properties.Item("bindingInformation").Value = "809:*";
  18: bindingsCollection.AddElement(bindingElement);
  19:  
  20: adminManager.CommitChanges();

4. Enable net.tcp for website (Virtual Application) that hosts Wcf Service – in this example we’re hosting in the root of website

image

And of course the script:

   1: var adminManager = new ActiveXObject('Microsoft.ApplicationHost.WritableAdminManager');
   2: adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST";
   3:  
   4: var sitesSection = adminManager.GetAdminSection("system.applicationHost/sites", "MACHINE/WEBROOT/APPHOST");
   5:  
   6: var sitesCollection = sitesSection.Collection;
   7:  
   8: var siteElementPos = FindElement(sitesCollection, "site", ["name", "WcfNetTcp"]);
   9: if (siteElementPos == -1) throw "Element not found!";
  10: var siteElement = sitesCollection.Item(siteElementPos);
  11:  
  12: var siteCollection = siteElement.Collection;
  13:  
  14: var applicationElementPos = FindElement(siteCollection, "application", ["path", "/"]);
  15: if (applicationElementPos == -1) throw "Element not found!";
  16: var applicationElement = siteCollection.Item(applicationElementPos);
  17:  
  18: applicationElement.Properties.Item("enabledProtocols").Value = "http,net.tcp";
  19:  
  20: adminManager.CommitChanges();

Warning: Do not put any spaces in “Enabled Protocols” field. Although it might works for HTTP it doesn’t for net.tcp.

5. (Optional) Run in elevated mode (As Administrator):

   1: “%WINDIR%\Microsoft.NET\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe" –i

I will cover why it is optional in next posts.

Note: Scripts are generated using IIS 7.5 IIS Management console and Windows 7


SOURCE:http://www.galcho.com/Blog/PermaLink.aspx?guid=2f8e0253-970d-4e8e-b1db-d2dcd4c80cee

MS dot Net Architecture

Version Correspondence - Visual Studio vs. EntLib vs. Platform SDK

Versions of .NET Framework and Visual Studio are paired. Visual Studio versions can co-exist on the same machine.

.NET Framework version Visual Studio version Launch OS Support Features EntLib Platform
SDK XML
v1.0.3705 2002 - - - - - -
v1.1.4322 2003 - XP (IE 6.00), 2000 (IE 5.01) Not shipped with Vista. 1.1 June 2005 - -
v2.0.50727 2005 Nov. 2005 - - 2.0 Jan. 2006
3.1 May 2007 5.0 -
v3.0 2008 May 2008 Shipped with Vista, download for XP SP1 (IE 7),
Server 2003 WCF, WF, WPF, LINQ to SQL, Silverlight 4.0 May 2008 6.0 (WinFX) -
v3.5 (30729) SP1 2008 SP1 x64 & IA64 Oct 2008 download for XP SP2,
Vista,
Server 2003 SP1 SQL Server 2008 support. Dependency injection (DI IoC pattern)/interception/cross-cutting mechanism in the Unity Application Block. 4.1 Oct 2008 6.1 -
v3.5 update - - - KB958481 - - -
v4.0 2010 Beta1 2009 Windows 7 Parallel processing 5.0? - -

LINQ (Language-Integrated Query) language extensions in C# and VB (introduced in 2008) enable access to in-memory and XML structures as well as databases using syntax like SQL, but as program commands, not as embedded SQL strings. This LINQ is good because crashing at run-time, errors in database names and datatypes are referenced as strongly typed objects which appear as intellisense and can be caught at compile-time.

WF (Windows Workflow Foundation) for asynchronous/manual processing of sequential or state-machine flows,

WPF (Windows Presentation Foundation), defined by .baml (Binary XAML) files and displayed by Silverlight/Mac Moonlight player competing with Adobe Flashanother page on this site


Go to Top of this page.
Previous topic this page
Next topic this page
Set screen The Cathedral and the Bazaar

Eric S. Raymond used this phrase to explain the difference between Microsoft's preferenced for a closed Cathedral approach versus open-source approaches by Java vendors.

For large organizations, Microsoft's cathedral provides more stability and control because of the closed, incremental approach. More importantly, Microsoft's approach yields a larger base of capable developers and users. A focused set of users raises the economic threshold for when investors are willing to invest in subsidiary products and services such as training products.

Because of its diversity, developer attention is fragmented in the open source world, which makes it difficult to find and keep good people. In order to keep up with the fast pace of technological change, developers need to jump to the next hottest thing (even before making the current technology truely usable).

This may change as the popularity of Google Apps grows and concentrates developer attention.

Microsoft's ".NET" (dot net) strategy and ".NET Framework" technical architecture is Microsoft's answer to Java and CORBA.

A Sharp Java Killer?
Microsoft had first said J++ is no longer one of the languages in the Visual Studio.NET suite of many languages. Early on, Microsot provided a Java User Migration Path (JUMP) to the C# language (pronounced "see sharp"). However, Java is now a supported language as J#.

Microsoft counters Java's “Write once, Run anywhere” premise with “Write many languages, Run on one Micosoft platform”.

Set screen CLR (Common Language Runtime)
Microsoft rewrote the Java runtime into Microsoft's own Intermediate Language (MSIL) called OptIL, associated compilers: one for each of the "20" existing programming source languages, and a run-time compiler to create machine code executable native to each hardware platform.

Much like the Java RunTime engine, a Common Language Runtime (CLR) execution engine (EE) "assembles" and "manages" OptIL code and provides services such as memory management, cross language integration, exception handling, code access security, and automatic lifetime control of objects.

Microsoft OptIL vs. Java IDL Compiler
Microsoft 's replacement for IDL (Interface Definition Language) is to have self-describing objects. The new OptIL compilers supply metadata for the .NET Framework to locate and unwind stack frames, and include information required for debugging and garbage collection, as well as security attributes, marshaling data, extended class and member definitions, version binding, and other information required by the runtime.

.NET applications, components, and controls are built using Microsoft's .NET Framework class library. Existing "unmanaged" COM applications will use a COM callable wrapper (CCW) to access system functionality managed by CLS-compliant library of classes, interfaces, and value types.

.NET applications code written using this contract of cooperation is called "managed" code.

ASP.NET vs. Java EJB
ASP.NET is the next generation ASP's proprietary server-side web services programming model. New features include the Windows Forms frameworkon this page.

IIS vs. Apache Tomcat Web Server
As of VS 2005, ASP.NET can be developed without IIS (Internet Information Service).



[45-minutes] .NET Framework Overviews by Brad Abrams, Microsoft's lead program manager on the .NET Framework team, and and C# inventor Anders Heilsberg

The Foundstone dot NET Security Framework

Micrsoft's public .NET demo sites:
A website external to this site ibuyspy.com retail store

A website external to this site FMStocks.com .NET service Fitch and Mather was written in VB and C#.

A website external to this site Favorites.com .NET service "Domain Market".
More from Micrsoft
Microsoft's .NET Framework Overview and Glossary.

Microsoft's XML TOC

Preparing Your Visual Basic 6.0 Applications for the Upgrade to Visual Basic.NET This October 2000 article discusses the fundamental architectural issues when upgrading from Visual Basic 6 to Visual Basic.NET using the Visual Basic.NET Upgrade Tool.

Microsoft has a 5 day course 2373B Programming with Microsoft Visual Basic.NET offered for $2,125 by Quickstart

IBM and Microsoft, (without Sun) created the Web Services Interoperability Organization (WS-I), industry consortium.

download Download Dotnetredist.exe Microsoft .NET Redistributable Package (21.8 MB). When executed, it extracts file Dotnetfx.exe and client time elements for the .NET Framework.


Go to Top of this page.
Previous topic this page
Next topic this page
Set screen Windows Platform SDK

A version of the SDK is installed. The path to the current SDK's \Bin or \Bin\x64 folder should be in the Environment Variable PATH.

o The Windows Platform SDK for 32 & 64-bit Windows Server 2008/2003, Vista SP1/XP and .NET Framework 3.5 (Setup.exe dated 2/5/2008, which retrieves the 1,4GB contents of the ISO CD) and installs (in 1 hour) to folder
C:\Program Files\Microsoft SDKs\Windows\v6.1\Bin
This obsoletes:
o

C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\x64
o Windows 2003/XP/2000 R2 Platform SDK Web Install - March 2006 Edition which installs to folder
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Bin
o Windows Vista Platform SDK does not support use of the Digital ID file (generally called MyCredentials.spc) and private key (MyPrivateKey.pvk). This is explained in KB SO5820. This is installed to
C:\Program Files\Microsoft SDKs\Windows\v6.0\Bin


Go to Top of this page.
Previous topic this page
Next topic this page
Set screen Visual Studio vs. Eclipse IDEs

The two most popular developer development environments are Microsoft Visual Studio and open-source Eclipse.

Versions of the Microsoft's .NET Framework and Visual Studio are paired, and can co-exist on the same machine.

Telephone, PDA and other mobile device applications are constructed using Microsoft's .NET Compact Framework 2.0.

[Microsoft's dot Net Framework]


Go to Top of this page.
Previous topic this page
Next topic this page
Set screen ASP.NET

10 ASP.NET Performance and Scalability Secrets By Omar Al Zabir


Go to Top of this page.
Previous topic this page
Next topic this page
Set screen "Doesn't Play Well With Others"

Microsoft has been criticized for not being very much involved with the development of Business Transaction Protocols (BTP) by Boston-based OASIS (Organization for the Advancement of Structured Information Standards) -- which maintains the xml.coverpages.org -- and the United Nations CEFACT , who are trying to standardize XML tag names for all business transactions being conducted on-line.

Let's see how long Microsoft will be part of this group or break off so they can claim patent rights on what others have developed.

MS SOAP vs. IIOP vs. REST vs. JSON
SOAP is also supported by Java and J2EE.

BizTalk
Microsoft submitted the SOAP specification to W3C.



Microsoft has the MCAD - Microsoft Certified Application Developer for .NET credential.

Microsoft ADO.NET (Core Reference) by David Sceppa

Introducing Microsoft .NET My Services by Jeannine Gailey and Christopher A. Jones

Inside C#, Second Edition by Tom Archer

Microsoft Visual C# (Core Reference) by Mickey Williams

Building COM+ Applications Using Microsoft .NET Enterprise Services, Course 2557

Application Upgrade and Interoperability Using Visual Studio .NET, Course 2571


Go to Top of this page.
Previous topic this page
Next topic this page
Set screen WCF Web Services

WCF (Windows Communication Foundation) System.ServiceModel

The life of a service InstanceContextMode enumeration PerCall (state unaware), PerSession, Single Service BehaviorAtttribute


Go to Top of this page.
Previous topic this page
Next topic this page
Set screen Web Services

Application
Concept Web
Standard Programs
Data XML Universal data format Objects
Schema XSD Universal type system Classes
Directory UDDI Directory of Services
Listing DISCO Service discovery
Services WSDL Service descriptions Methods
Services Invocation SOAP Calls
Services Invocation REST Calls

* Visual Studio SOAP toolkit for Microsoft Windows� 2000 (not Win 9x) can be download from
o Versions:
+ Version 1 released July 2000 interoperates with Visual Studio.NET Beta 1 uses older Service Description Language (SDL) and scalar atomic data types using UTF-8 encoding based on Windows code page 1252.
+ Version 2 Beta 1 released January 2, 2001 based on SOAP Specification version 1.1, adds support for new Web Services Description Language (WSDL) 1.0 contracts to define the SOAP messages and service call formats; Universal Description, Discovery and Integration (UDDI), and the Version 2.0 will pass strings to BSTR parameters encoded as UTF-16.
+ The final release of SOAP Toolkit version 2.0 will be fully supported by Microsoft product support.
o This requires Visual Studio SP 4.
o The Listener provided is ASP, not ISAPI.
o MSXML Parser 3.0 is included in the SOAP toolkit.
* All this work done by developers will be hadled automatically by Microsoft's Visual Studio.NET which was distributed as Beta 1 on January 2001.

Although VisualBasic.NET (also known as Visual Basic 7.0) features new Web Forms which are HTML pages with Visual Basic events (such as native support for accessibility). Microsoft recommends using it for business objects and use ASP.NET, an enhanced version of ASP, which uses Web Forms for interfacing with Web Services hosted by ASP.NET, which targets disconnected data. The Mobile Internet Toolkit is part of ASP.NET.

The NET Framework SDK TDG (Tool Developer Guide) is included in the ASP.NET CD to manipulate new & old registry classes.





Chris Dengler's July 2000 SDL wrapper code to returing ADO Recordtypes and arrays with SOAP messaging.

Recommended book Understanding SOAP: The Authoritative Solution by Kennard Scribner SAMS ISBN 0-672-31922-5 Get this book discounted from Amazon



Go to Top of this page.
Previous topic this page
Next topic this page
Set screen Plumbing

dot NET eliminiates COM plumbing

COM dot NET
Registration self-described apps
GUIDs hierarchial namespaces
.IDL files unified object model
HRESULTs structured execptions
IUnknown common root object
AddRef/release automatic garbabe collector
CoCreateInstance new operator



Code Profilers

tool $295 ANTS (Advanced .NET Tool Suite) Profiler works with $690 ANTS Load and $2985 ANTS Enterprise Load. From Red-gate, makers of SQL Compare and SQL Data Compare.

tool DevPartner from Compuware

tool Borland's $700 Optimizeit Profiler for the Microsoft .NET Framework

tool Performance Tips and Tricks in .NET Applications: A .NET Developer Platform White Paper by Emmanuel Schanzer, August 2001

tool Performance Considerations for Run-Time Technologies in the .NET Framework: A .NET Developer Platform White Paper by Emmanuel Schanzer, August 2001


Go to Top of this page.
Previous topic this page
Next topic this page
Set screen Assets

This describes the artifacts of an XML based system, starting from the client's point of view.





Graphic based on Karthik Ravindran's voice presentation: Implementing and Accessing Web Services Using Visual Basic 6.0 and the SOAP Toolkit for Visual Studio

Go to Top of this page.
Previous topic this page
Next topic this page

Set screen Client ROPE Proxy
A ROPE proxy serves a similiar function as WinSock, through which client software issue and receive communications to web services on a web server.

If a SOAP client is on a different computer than the SOAP server, you will need to copy ROPE.dll from the Visual Studio SOAP Toolkit and register it on the client computer (tunning command regsvr32 rope.dll).

Got SOAP?

The ROPE Proxy uses methods in COM objects written to SOAP standard which defines the "handshaking" between client and server.

A client first sends a Services Description method ROPE.SDMethodInfo and other methods to discover what web services a particular server provides on this page

The ROPE.SoapPackager object creates a SOAP envelope and calls

It then calls ROPE.WireTransfer to execute HTTP GET and POST requests by calling methods AddStdSOAPHeaders and PostDataToURI using parameters DataSent and DataReceived.

Web Serices Discovery
methods in the ROPE.SDServiceDescriptors collection: <> ROPE.SDEndPointInfo describes the URI location of web services.

ROPE.SDMethodInfo provides information about methods exposed by a Web Service.

ROPE.SDParameterInfo then provides requirements for calling those methods.

WSDL = Web Services Description Language
Describes the methods available. contract between a server and its clients. Example: ProdInfo.dll

SDL = Service Description Language
Here is a sample request.







The SDL wizard can generate this.

ASP
XML references COM methods.

<%@ language=VB Script %>
<%Option Explicit

ADO









For XML Schema






Go to Top of this page.
Previous topic this page
Next topic this page
Set screen Resources

For programming advice, tips, code snippets, and answers to technical questions from developers using the latest technologies? Try one of these independent Web communities:

angryCoder Check out this e-zine, written using the Microsoft .NET Framework, where you can submit articles and download source code for a minimal donation.

C# Corner has developers using C# and .NET meet and exchange their ideas, code, and expertise through discussion forums or submissions.

The Code Project is a community of developers using Windows who specialize in C++, MFC, C#, and .NET.

DotNetJunkies.com offers information, tools, and education utilizing the ASP.NET Framework.

Visual Studio and dot Net

International .NET Association
User groups interested in the Microsoft .NET platform have the International .NET Association (http://www.ineta.org) resource to connect with their peers and sponsors.

INETA enables interaction among user groups interested in .NET, providing them with unique educational support. Make sure your user group is as vibrant and effective as it can be in providing .NET education-register with INETA today at http://info@ineta.org.



tool Lutz Roeder's Reflector for .NET is a class browser for .NET components and assemblies. It features hierarchical assembly and namespace views, type and member dictionary index search, type reference search, custom attributes view, an IL disassembler and viewers for C# XML documentations and MSDN help. Assembly dependency trees, supertype/subtype hierarchies and resources can be inspected as well. Function prototypes are displayed in C#, VB and Eiffel syntax. Windows XP enabled.


Go to Top of this page.
Previous topic this page
Next topic this page
Set screen VS.NET IDE

The VS.NET IDE (Integrated development environment) is named devenv.exe. So you can invoke it by typing "devenv" (with no quotes) from the Run window. To use shortcut keys, type Ctrl-Esc, R (for Run), devenv, Enter.

When Visual Studio is installed, you are prompted to set Envrionment settings for General, Visual Basic, C#, or Web Development. If later you want to switch, in menu Tools > Import and Export Settings > Reset all settings option.

Projects exist within a Solution. By default, project files are saved on Vista machine's
C:\Users\user\Documents\Visual Studio 2008\Projects\MyProject

Efficiently Using Expressions (Aggregates, Selections,



Pelli's dotNetWiki.org blog & forum offering downloads.

Visual Studio Magazine columns by Roger Jennings of Oakleaf Systems July 2, 2002 on ACT

.NET Fun Facts at the Sprout


Go to Top of this page.
Previous topic this page
Next topic this page
Set screen Testing .NET

tool .TEST integrates with Microsoft� Visual Studio .NET� to perform Static Analysis of finished .NET Framework classes and methods based on "Best Practices" and ".NET Framework Design Guidelines". It automatically creates unit test harnesses, stubs, and test cases for automating regression testing. It's in the same Automated Error Prevention product line of group-oriented tools as Parasoft's JTest for Java.


SOURCE:http://www.wilsonmar.com/msdotnet.htm

MCA 6th Sem Training with Live Projects

As a part of Corporate Social Responsibility (CSR) we are entertaining application of engineering/ MCA students for industrial internship for 6 months duration. Eligible candidates need to pursue industrial training as a part of their course curriculum. We are entertaining application from students who are in their final semester of BE/ B. Tech. ME/ M. Tech / MCA, and are willing to pursue internship as part of their course curriculum

About CETPA Infotech:

CETPA Infotech, an Indian Multinational, ISO 9001:2008 Certified Company is a renowned name among Engineering Students and MCA/BCA professionals for providing quality education in the forms of 6 Months, Industrial, Winter & Summer Training. CETPA has formed a group of enthusiastic and well competent professionals, having a unique training methodology which makes CETPA Northern India's No-1 training Company with a bright history of training more than 35,000 engineers and professionals.


About CETPA 6 month training program

Today almost every Engineering & Professional graduate programs in India include 6 months/Winter/Summer Training as an important part of their curriculum, with an objective to enhance the knowledge of the students on different cutting edge technologies, which has been important part of respective industry but most of the students always run to obtain a merely certificate and due to this there is serious lack of trained professionals with the desired skill sets to take on the ever increasing demand of an industry.


In order to eradicate this deficiency and create skilled resources for the challenging industries, CETPA Infotech has designed a curriculum for 6 months training which incorporates a blending learning approach by integrating classrooms, hands on lab exercise and team projects to provide students both the theoretical & practical training, needed to build strong technical skills.


Eligibility: MCA/B.E/B-tech/ or equivalent in any stream.

Training Location: Roorkee, Noida, Greater Noida, Lucknow, Kyiv (Ukraine),

Schwerin (Germany)


Course Duration: 6 Months


Date of Starting: Different batches are starting in every 10 days gap from

December to March (Please refer website www.cetpainfotech.com for complete details)


Technologies:-

.NET
J2EE

C & C++

Embedded System

Advanced Embedded System
VHDL
Verilog HDL

Advanced CAD


Why CETPA Infotech?

· More than 8 years of Experience in Technology Training.

· A Competent group of 120 dedicated & highly skilled employees with 50+ in house Trainers

· Bright history of Training more than 35,000+ Students and Professional so far.

· State-of-the-art 50,000+ Sq. ft Training Infrastructure.

· 6+ Training Locations across the globe with all required modern facilities.

· Courses mapped with Industry Requirement in order to ensure 100% placement for our students.

· Strategic tie-ups with Global Technology leaders in order ensure quality training for our students, as well as placements.




Special Features of Training:

· Pay the training fee after 10 days of the starting of the Training Program.

· Top 10 Participants will be Placed in CETPA Infotech Pvt. Ltd.

· Opportunity to participate in campus placement of top companies.

· Guest Lectures by Experts from other Industries and Reputed Institutes like IIT’s.

· 10 MB Web Space and Software for Uploading the Website would be provided free of cost to each participant.

· Learning kit containing books and CDs would be provided free of cost to the students of all the programs.

· CETPA student Membership of $14 free of cost.

· Certificate of Honor to top participant from each program.

· Batch Dates once selected may be changed prior to 7 days of starting of the batch.

· Working on Live Project.


Free of Cost Technical Seminar at your college campus: CETPA can deliver a free of cost technical seminar at your campus for summer training. After the seminar, candidates can register for training, even at the college campus,

.

Training Programs at your college campus: CETPA can deliver a free of cost technical seminar at your campus for training at your college campus. After the seminar, if at least 40 students are interested to join the training, then same program may be conducted at your campus. This training program may be conducted at any time during whole year at your campus. For the seminar or training at your campus call us at 09212468020 or email us at vikaskalra@cetpainfotech.com, kalra_goc@yahoo.co.in.

Other CETPA Programs: 2 & 4 weeks Projects based winter training for MCA/B.Tech. Students from December to March. Regular training programs whole of the year at all of our campuses as well as at the college campuses. Summer training programs in the month of June, July & August for 4 Weeks or 6 Weeks.


CETPA Profile: CETPA INFOTECH PVT. LTD. is an ISO 9001:2008 Certified, Multinational Company having its head office at Roorkee and branches at Noida, Greater Noida, Lucknow, Germany, Ukraine and others. CETPA is having three divisions named as CETPA Development, CETPA Education and CETPA Consultancy. Under the head of CETPA Development we are indulge in Software Development, Web Development and Embedded Products Development. CETPA Education deals in Engineers Training Programs in latest technologies. CETPA Consultancy is always dedicated to provide high profile jobs to CETPA Certified Students. CETPA has already conducted On Campus Training Programs at more than 100 Engineering Colleges, most notable among these are Sri Balaji College Jaipur, Ajmer Institute Ajmer, Geetanjali Institute Udaipur, Birla Institute Bhimtal, MIT Muzaffarpur, KNIT Sultanpur, Madan Mohan Malviya College Gorakhpur, Ideal College Ghaziabad, MIET Meerut, RBMI Bareilly, MIT Moradabad, Babu Banarsi Das College Lucknow, IFTM Moradabad, Hindustan College of Science & Technology Mathura, G. B. Pant Engineering College Pauri Garhwal, DIT Dehradun, Kumanyon Engineering College Dwarahat Almora, Shri Sant Gadge Baba College Bhusawal, Jind Institute Jind, Lovely Professional University Jalandhar etc.

Placement Details: CETPA consultancy regularly invites reputed companies to our campus or our collaborative college campus for placement of CETPA Certified Students. In the year 2009, the biggest recruiter for CETPA certified students was, the world’s biggest gaming company named EA Games, EA sports. CETPA invited this company on 4th Dec 09 for the placement of CETPA Certified students in their development division. In this drive all CETPA Certified 2008, 2009, 2010 Batch Pass out candidates of any branch appeared for the placement. Best of Breed Software Solutions (I) P. Ltd. (Global Partner to Infosys and India Partner to HP and Wipro), came on 18th & 19th September 2010 and selected more than 40 candidates from our Noida Branch. Some of our other big recruiters are Best Web Online Pvt. Ltd. Delhi, Nisscom Gurgaon, Netsity Software Solutions India Pvt. Ltd. Delhi etc.


Live Projects: The participants who are interested to work on live projects can work on the specialized live projects. These live projects will be offered by CETPA Infotech Pvt. Ltd. and participants have to complete these projects in given time frame. This time frame may be 6 months or one year. If candidates complete these projects within time frame, then they will be awarded by CETPA and will be given experience letter for 6 months or one year depending on the time frame. Incentives may also be given to the candidates, depending upon their performance while handling the live projects. The groups for working on live projects will be decided by students.


Testimonials:

"We had conducted Campus Recruitment Preparation Program with CETPA at our campus. From the initial contacts to the conclusion of the course, we have found CETPA to be very professional and helpful in all aspects. We look forward to conduct other training programs in coming years."

Mr.Akhilesh Shukla -Head Continuing Education Department MIT, Moradabad

"The Training provided by CETPA is of a very high caliber. The staffs are highly skilled and flexible, making training a worth. We will continue to take CETPA Services in the future and would have no hesitation in recommending them to other Institutions."

Mr.Praveen Porwal-Head Training & Placement PSIT Kanpur

"In CETPA I learnt the magic of Coding .The constant and personal interaction with the trainer is the best part of CETPA. I thank CETPA for making my most cherished dream come true."

Mr.Anuj Kapoor- Infosys

"I joined CETPA because of their proven expertise in training budding engineers and professionals. Their ability to understand our problems and giving us the optimal solution is something, we have grown to expect from CETPA"

Tuesday, February 15, 2011

Wcf using NetTcpBinding

Introduction



This article is about implementing WCF using NetTcpBinding.NetTcpBinding can be useful where IIS services are not needed.

How it works?


1)The ServiceHost class has been used to configure and expose the service for use by the client application.

2)Add ServiceEndPoint method of ServiceHost Class
It adds a service endpoint to the hosted service with a specified contract(interface), binding(object of NetTcpBinding), and a URI that contains the endpoint address.

3)Open method launches the Service.


4) EndPointAddress class

Provides a unique network address that a client uses to communicate with a service endpoint. It is specified both in the server and the client and must be the same.

5) ChannelFactory class
It is a generic class that creates and manages the channels that are used by clients .to send messages to service endpoints.

For this, I have taken 3 applications

1)Class Library for creating the business component.
2)One Windows Application to provide the hosting environment.
3)Another Windows Application that will act as the client.

The A,B,C’s of WCF have been configured manually using the appropriate classes.

System.ServiceModel.dll has been included and the appropriate namespaces and classes have been included
to provide the implementation.

1)Business Component

The code for the Business Component has been defined in 2 files .First one is the interface file and second one is the

Class file that implements the interface logic. The name of the class library project was remlbb.

Add reference to System.ServiceModel.dll

Code of the interface

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
namespace remlbb
{
[ServiceContract]
public interface myinterface
{
[OperationContract]

string Upload(string s);

}
}


Delete the default class definition. Code of the class providing the implementation

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace remlbb
{
public class implementclass : myinterface
{
public string Upload(string s)
{
return "hello" + "--" + s;

}
}
}

Build the project. It would create remlbb.dll

  • The Server Application for providing the Hosting environment Give your own name to the application. I named it as WindowsFormsApplication7mar.
  • Take 2 buttons and change their Text to Start and Stop
  • Add reference to System.ServiceModel.dll and remlbb.dll

Type this code in the Form1.cs file

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.ServiceModel;
using remlbb;

namespace WindowsFormsApplication7mar
{
public partial class Form1 : Form
{
ServiceHost host;
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
host = new ServiceHost(typeof(implementclass));
NetTcpBinding binding = new NetTcpBinding();
host.AddServiceEndpoint(typeof(myinterface), binding, new Uri("net.tcp://localhost:5000/implementclass"));


host.Open();
MessageBox.Show("started");
button1.Enabled = false;
button2.Enabled = true;

}

private void button2_Click(object sender, EventArgs e)
{
host.Close();

button1.Enabled = true;
button2.Enabled = false;


}
}
}


Client Application

  • Give your own name to a Windows application. I named it as WindowsFormsApplication1.
  • Take 1 button and 1 TextBox.
  • Add reference to System.ServiceModel.dll and remlbb.dll

The code of the Client is like this (Form1.cs)

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.ServiceModel;
using remlbb;

namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
myinterface idd;
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
NetTcpBinding binding = new NetTcpBinding();

EndpointAddress addr = new EndpointAddress("net.tcp://localhost:5000/implementclass");

ChannelFactory chn = new ChannelFactory(binding, addr);

idd = chn.CreateChannel();
}

private void button1_Click(object sender, EventArgs e)
{
string y = idd.Upload(textBox1.Text);

MessageBox.Show(y);
}
}
}

To Execute:-


  1. Click the exe of the server application
  2. Click the start button
  3. Click the exe of the client application
  4. Enter some text in the text box and press the Button. It should display the text entered in a textbox concatenated with Hello.
  5. To stop the service, click the stop button in the exe of server application
Happy Coding !

SOURCE:http://www.dotnetfunda.com/articles/article1112-wcf-using-nettcpbinding-.aspx