<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Miteshisheth&#039;s Blog</title>
	<atom:link href="http://miteshisheth.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://miteshisheth.wordpress.com</link>
	<description>.NET Technologies</description>
	<lastBuildDate>Thu, 22 Dec 2011 15:23:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='miteshisheth.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Miteshisheth&#039;s Blog</title>
		<link>http://miteshisheth.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://miteshisheth.wordpress.com/osd.xml" title="Miteshisheth&#039;s Blog" />
	<atom:link rel='hub' href='http://miteshisheth.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Authorization Filter &#8211; Reusable/Common components for ASP.NET MVC 3.0</title>
		<link>http://miteshisheth.wordpress.com/2011/07/20/authorization-filter-reusablecommon-components-for-asp-net-mvc-3-0/</link>
		<comments>http://miteshisheth.wordpress.com/2011/07/20/authorization-filter-reusablecommon-components-for-asp-net-mvc-3-0/#comments</comments>
		<pubDate>Wed, 20 Jul 2011 14:52:58 +0000</pubDate>
		<dc:creator>miteshisheth</dc:creator>
				<category><![CDATA[ASP.NET MVC 3]]></category>
		<category><![CDATA[Security - MVC 3]]></category>

		<guid isPermaLink="false">https://miteshisheth.wordpress.com/2011/07/20/authorization-filter-reusablecommon-components-for-asp-net-mvc-3-0/</guid>
		<description><![CDATA[&#160; Suppose we want to apply an authorization to every action except the action that lets the user login than Decorate [Authorize] attribute to all methods except login one. Code There are some risks if we follow above approach. 1. Programmer might miss to decorate one or more method (Security risk) 2. Maintainability issue. Require [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=miteshisheth.wordpress.com&amp;blog=8485788&amp;post=252&amp;subd=miteshisheth&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>&#160;</p>
<p>Suppose we want to apply an authorization to every action except the action that lets the user login than Decorate [Authorize] attribute to all methods except login one.</p>
<p><a href="https://skydrive.live.com/?cid=39f476822b8257be&amp;sc=documents&amp;uc=1&amp;id=39F476822B8257BE%21187#" target="_blank">Code</a></p>
<p>There are some risks if we follow above approach.</p>
<p>1. Programmer might miss to decorate one or more method (Security risk)</p>
<p>2. Maintainability issue. Require to prepare tracker.</p>
<p>To solve above problem, now ASP.NET MVC 3 introduces global filters. For this we have to create class which derived from Authorize class (LogonAuthorize – which I have created ) and register into Global.asax.</p>
<p>Once we register custom Authorize class into Global.asax, it introduce another problem. We can’t call the logon and registration methods too because we have set globally that before calling any action method, user must be login into application.</p>
<p>To solve above problem, we have to write attribute (AllowAnonymous &#8211; which I have created) and inform to the application that don’t expect login if any action method is decorated with AllowAnonymous.</p>
<p>I have made class library for LogonAuthorize and AllowAnonymous. So any consumer should give the reference of dll and add below code in respected global.asax (In pinkcolour).</p>
<p>public class MvcApplication : System.Web.HttpApplication</p>
<p>{</p>
<blockquote><p>public static void RegisterGlobalFilters(GlobalFilterCollection filters)</p>
</blockquote>
<blockquote><p>{</p>
<p>filters.Add(new HandleErrorAttribute());</p>
<p><font color="#ff00ff"><strong>filters.Add(new LogonAuthorize());</strong></font></p>
<p>}</p>
</blockquote>
<blockquote><p>public static void RegisterRoutes(RouteCollection routes)</p>
<p>{</p>
<p>routes.IgnoreRoute(&quot;{resource}.axd/{*pathInfo}&quot;);</p>
<p>routes.MapRoute(</p>
<p>&quot;Default&quot;, // Route name</p>
<p>&quot;{controller}/{action}/{id}&quot;, // URL with parameters</p>
<p>new { controller = &quot;Home&quot;, action = &quot;Index&quot;, id = UrlParameter.Optional } // Parameter defaults</p>
<p>);</p>
</blockquote>
<p>}</p>
<p>protected void Application_Start()</p>
<p>{</p>
<p>AreaRegistration.RegisterAllAreas();</p>
<p>RegisterGlobalFilters(GlobalFilters.Filters);</p>
<p>RegisterRoutes(RouteTable.Routes);</p>
<p>}</p>
<p>}</p>
<p>Now for action method, decorate AllowAnonymous , if we want to give Anonymous access.</p>
<p>[AllowAnonymous]</p>
<p>public ActionResult Register()</p>
<p>{</p>
<p>return View();</p>
<p>}</p>
<p>So now when we run the application, we can call Register action before login.</p>
<p>Even after implementing custom filter, we can decorate action method with [Authorize] and used all the features.</p>
<p>[Authorize(Users = &quot;ABCXYZ&quot;)]</p>
<p>public ActionResult About()</p>
<p>{</p>
<p>return View();</p>
<p>}</p>
<p>&#160;</p>
<p>This blog is for information purpose only. Please contact for any conflict.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/miteshisheth.wordpress.com/252/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/miteshisheth.wordpress.com/252/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/miteshisheth.wordpress.com/252/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/miteshisheth.wordpress.com/252/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/miteshisheth.wordpress.com/252/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/miteshisheth.wordpress.com/252/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/miteshisheth.wordpress.com/252/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/miteshisheth.wordpress.com/252/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/miteshisheth.wordpress.com/252/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/miteshisheth.wordpress.com/252/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/miteshisheth.wordpress.com/252/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/miteshisheth.wordpress.com/252/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/miteshisheth.wordpress.com/252/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/miteshisheth.wordpress.com/252/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=miteshisheth.wordpress.com&amp;blog=8485788&amp;post=252&amp;subd=miteshisheth&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://miteshisheth.wordpress.com/2011/07/20/authorization-filter-reusablecommon-components-for-asp-net-mvc-3-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bf7c284e28c7cddce77364c96cbb203c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">miteshisheth</media:title>
		</media:content>
	</item>
		<item>
		<title>Windows Azure</title>
		<link>http://miteshisheth.wordpress.com/2010/07/27/windows-azure/</link>
		<comments>http://miteshisheth.wordpress.com/2010/07/27/windows-azure/#comments</comments>
		<pubDate>Tue, 27 Jul 2010 16:13:35 +0000</pubDate>
		<dc:creator>miteshisheth</dc:creator>
				<category><![CDATA[cloud]]></category>

		<guid isPermaLink="false">https://miteshisheth.wordpress.com/2010/07/27/windows-azure/</guid>
		<description><![CDATA[What is Azure platform? The Windows Azure platform is an internet-scale cloud computing services platform hosted in Microsoft data centers. The Windows Azure platform, which provides a range of functionality to build applications that span from consumer Web to enterprise scenarios, includes a cloud services operating system and a set of developer services. Windows Azure, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=miteshisheth.wordpress.com&amp;blog=8485788&amp;post=234&amp;subd=miteshisheth&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal"><b><span style="line-height:115%;font-size:14pt;">What is Azure platform?
</p>
<p>     </span></b></p>
<p class="MsoNormal">The Windows Azure platform is an internet-scale cloud computing services platform hosted in Microsoft data centers. The Windows Azure platform, which provides a range of functionality to build applications that span from consumer Web to enterprise scenarios, includes a cloud services operating system and a set of developer services. Windows Azure, Microsoft SQL Azure and AppFabric are the key components of the Windows Azure platform.</p>
<p class="MsoNormal">
<p>&#160;</p>
</p>
<p class="MsoNormal"><b><span style="line-height:115%;font-size:14pt;">What is Windows Azure?
</p>
<p>     </span></b></p>
<p class="MsoNormal">Windows Azure provides developers with on-demand compute and storage to host, scale and manage Web applications on the Internet through Microsoft data centers.</p>
<p class="MsoNormal">
<p>&#160;</p>
</p>
<p class="MsoNormal"><b><span style="line-height:115%;font-size:14pt;">What is Microsoft Sql Azure?
</p>
<p>     </span></b></p>
<p class="MsoNormal">Microsoft SQL Azure delivers on Microsoft’s SQL Server® Data Platform vision of extending the Data Platform capabilities in cloud as web-based services. SQL Azure enables a rich set of services for relational database, reporting; and analytics and data synchronization with mobile users, remote offices and business partners</p>
<p class="MsoNormal"><b><span style="line-height:115%;font-size:14pt;">What is AppFabric Service bus and Access Control?
</p>
<p>     </span></b></p>
<p class="MsoNormal">The Service Bus enables loosely-coupled connectivity between services and applications across firewall or network boundaries, using a variety of communication patterns. The Access Control Service provides federated, claims-based access control for REST web services. Developers can use these services to build distributed or composite applications and services.</p>
<p class="MsoNormal"><b><span style="line-height:115%;font-size:14pt;">Compute Instance
</p>
<p>     </span></b></p>
<p style="line-height:10.5pt;" class="MsoNormal"><span style="font-family:&quot;color:#353535;font-size:8.5pt;">Windows Azure compute instances come in four unique sizes to enable complex applications and workloads.
</p>
<p>   </span></p>
<table style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:windowtext 1pt solid;border-right:windowtext 1pt solid;" class="MsoNormalTable" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;background:#e7f7fd;border-top:windowtext 1pt solid;border-right:windowtext 1pt solid;padding:3.75pt;">
<p style="line-height:normal;margin-bottom:12.75pt;" class="MsoNormal"><b><span style="font-family:&quot;color:#353535;font-size:8.5pt;">Compute Instance Size
</p>
<p>             </span></b></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;background:#e7f7fd;border-top:windowtext 1pt solid;border-right:windowtext 1pt solid;padding:3.75pt;">
<p style="line-height:normal;margin-bottom:12.75pt;" class="MsoNormal"><b><span style="font-family:&quot;color:#353535;font-size:8.5pt;">CPU
</p>
<p>             </span></b></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;background:#e7f7fd;border-top:windowtext 1pt solid;border-right:windowtext 1pt solid;padding:3.75pt;">
<p style="line-height:normal;margin-bottom:12.75pt;" class="MsoNormal"><b><span style="font-family:&quot;color:#353535;font-size:8.5pt;">Memory
</p>
<p>             </span></b></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;background:#e7f7fd;border-top:windowtext 1pt solid;border-right:windowtext 1pt solid;padding:3.75pt;">
<p style="line-height:normal;margin-bottom:12.75pt;" class="MsoNormal"><b><span style="font-family:&quot;color:#353535;font-size:8.5pt;">Instance Storage
</p>
<p>             </span></b></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;background:#e7f7fd;border-top:windowtext 1pt solid;border-right:windowtext 1pt solid;padding:3.75pt;">
<p style="line-height:normal;margin-bottom:12.75pt;" class="MsoNormal"><b><span style="font-family:&quot;color:#353535;font-size:8.5pt;">I/O Performance
</p>
<p>             </span></b></p>
</td>
</tr>
<tr>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:windowtext 1pt solid;border-right:windowtext 1pt solid;padding:3.75pt;" valign="top">
<p style="line-height:normal;margin-bottom:12.75pt;" class="MsoNormal"><span style="font-family:&quot;color:#353535;font-size:8.5pt;">Small
</p>
<p>           </span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:windowtext 1pt solid;border-right:windowtext 1pt solid;padding:3.75pt;" valign="top">
<p style="line-height:normal;margin-bottom:12.75pt;" class="MsoNormal"><span style="font-family:&quot;color:#353535;font-size:8.5pt;">1.6 GHz
</p>
<p>           </span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:windowtext 1pt solid;border-right:windowtext 1pt solid;padding:3.75pt;" valign="top">
<p style="line-height:normal;margin-bottom:12.75pt;" class="MsoNormal"><span style="font-family:&quot;color:#353535;font-size:8.5pt;">1.75 GB
</p>
<p>           </span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:windowtext 1pt solid;border-right:windowtext 1pt solid;padding:3.75pt;" valign="top">
<p style="line-height:normal;margin-bottom:12.75pt;" class="MsoNormal"><span style="font-family:&quot;color:#353535;font-size:8.5pt;">225 GB
</p>
<p>           </span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:windowtext 1pt solid;border-right:windowtext 1pt solid;padding:3.75pt;" valign="top">
<p style="line-height:normal;margin-bottom:12.75pt;" class="MsoNormal"><span style="font-family:&quot;color:#353535;font-size:8.5pt;">Moderate
</p>
<p>           </span></p>
</td>
</tr>
<tr>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:windowtext 1pt solid;border-right:windowtext 1pt solid;padding:3.75pt;" valign="top">
<p style="line-height:normal;margin-bottom:12.75pt;" class="MsoNormal"><span style="font-family:&quot;color:#353535;font-size:8.5pt;">Medium
</p>
<p>           </span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:windowtext 1pt solid;border-right:windowtext 1pt solid;padding:3.75pt;" valign="top">
<p style="line-height:normal;margin-bottom:12.75pt;" class="MsoNormal"><span style="font-family:&quot;color:#353535;font-size:8.5pt;">2 x 1.6 GHz
</p>
<p>           </span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:windowtext 1pt solid;border-right:windowtext 1pt solid;padding:3.75pt;" valign="top">
<p style="line-height:normal;margin-bottom:12.75pt;" class="MsoNormal"><span style="font-family:&quot;color:#353535;font-size:8.5pt;">3.5 GB
</p>
<p>           </span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:windowtext 1pt solid;border-right:windowtext 1pt solid;padding:3.75pt;" valign="top">
<p style="line-height:normal;margin-bottom:12.75pt;" class="MsoNormal"><span style="font-family:&quot;color:#353535;font-size:8.5pt;">490 GB
</p>
<p>           </span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:windowtext 1pt solid;border-right:windowtext 1pt solid;padding:3.75pt;" valign="top">
<p style="line-height:normal;margin-bottom:12.75pt;" class="MsoNormal"><span style="font-family:&quot;color:#353535;font-size:8.5pt;">High
</p>
<p>           </span></p>
</td>
</tr>
<tr>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:windowtext 1pt solid;border-right:windowtext 1pt solid;padding:3.75pt;" valign="top">
<p style="line-height:normal;margin-bottom:12.75pt;" class="MsoNormal"><span style="font-family:&quot;color:#353535;font-size:8.5pt;">Large
</p>
<p>           </span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:windowtext 1pt solid;border-right:windowtext 1pt solid;padding:3.75pt;" valign="top">
<p style="line-height:normal;margin-bottom:12.75pt;" class="MsoNormal"><span style="font-family:&quot;color:#353535;font-size:8.5pt;">4 x 1.6 GHz
</p>
<p>           </span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:windowtext 1pt solid;border-right:windowtext 1pt solid;padding:3.75pt;" valign="top">
<p style="line-height:normal;margin-bottom:12.75pt;" class="MsoNormal"><span style="font-family:&quot;color:#353535;font-size:8.5pt;">7 GB
</p>
<p>           </span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:windowtext 1pt solid;border-right:windowtext 1pt solid;padding:3.75pt;" valign="top">
<p style="line-height:normal;margin-bottom:12.75pt;" class="MsoNormal"><span style="font-family:&quot;color:#353535;font-size:8.5pt;">1,000 GB
</p>
<p>           </span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:windowtext 1pt solid;border-right:windowtext 1pt solid;padding:3.75pt;" valign="top">
<p style="line-height:normal;margin-bottom:12.75pt;" class="MsoNormal"><span style="font-family:&quot;color:#353535;font-size:8.5pt;">High
</p>
<p>           </span></p>
</td>
</tr>
<tr>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:windowtext 1pt solid;border-right:windowtext 1pt solid;padding:3.75pt;" valign="top">
<p style="line-height:normal;margin-bottom:12.75pt;" class="MsoNormal"><span style="font-family:&quot;color:#353535;font-size:8.5pt;">Extra large
</p>
<p>           </span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:windowtext 1pt solid;border-right:windowtext 1pt solid;padding:3.75pt;" valign="top">
<p style="line-height:normal;margin-bottom:12.75pt;" class="MsoNormal"><span style="font-family:&quot;color:#353535;font-size:8.5pt;">8 x 1.6 GHz
</p>
<p>           </span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:windowtext 1pt solid;border-right:windowtext 1pt solid;padding:3.75pt;" valign="top">
<p style="line-height:normal;margin-bottom:12.75pt;" class="MsoNormal"><span style="font-family:&quot;color:#353535;font-size:8.5pt;">14 GB
</p>
<p>           </span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:windowtext 1pt solid;border-right:windowtext 1pt solid;padding:3.75pt;" valign="top">
<p style="line-height:normal;margin-bottom:12.75pt;" class="MsoNormal"><span style="font-family:&quot;color:#353535;font-size:8.5pt;">2,040 GB
</p>
<p>           </span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:windowtext 1pt solid;border-right:windowtext 1pt solid;padding:3.75pt;" valign="top">
<p style="line-height:normal;margin-bottom:12.75pt;" class="MsoNormal"><span style="font-family:&quot;color:#353535;font-size:8.5pt;">High
</p>
<p>           </span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal">
<p>&#160;</p>
</p>
<p class="MsoNormal"><span style="line-height:115%;font-family:&quot;color:#353535;font-size:8.5pt;">Each Windows Azure compute instance represents a virtual server
</p>
<p>   </span></p>
<p class="MsoNormal">
<p>&#160;</p>
</p>
<p class="MsoNormal"><b><span style="line-height:115%;font-size:14pt;">Pricing for Azure
</p>
<p>     </span></b></p>
<p style="line-height:10.5pt;margin-bottom:12.75pt;" class="MsoNormal"><span style="font-family:&quot;color:#353535;font-size:8.5pt;">Monthly usage exceeding the amount included in the Base Units purchased will be charged at the standard rates:
</p>
<p>   </span></p>
<p style="line-height:10.5pt;margin-bottom:12.75pt;" class="MsoNormal"><b><span style="font-family:&quot;color:#353535;font-size:8.5pt;">Windows Azure
</p>
<p>     </span></b></p>
<p style="line-height:10.5pt;text-indent:-18pt;margin-bottom:2.25pt;margin-left:30pt;" class="MsoNormal"><span style="font-family:symbol;color:#353535;font-size:10pt;"><span>·<span style="font:7pt &quot;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span></span></span><span style="font-family:&quot;color:#353535;font-size:8.5pt;">Compute
</p>
<p>   </span></p>
<p style="line-height:10.5pt;text-indent:-18pt;margin-bottom:2.25pt;margin-left:48.75pt;" class="MsoNormal"><span style="font-family:wingdings;color:#353535;font-size:10pt;"><span>§<span style="font:7pt &quot;">&#160; </span></span></span><span style="font-family:&quot;color:#353535;font-size:8.5pt;">Small instance (default): $0.12 per hour
</p>
<p>   </span></p>
<p style="line-height:10.5pt;text-indent:-18pt;margin-bottom:2.25pt;margin-left:48.75pt;" class="MsoNormal"><span style="font-family:wingdings;color:#353535;font-size:10pt;"><span>§<span style="font:7pt &quot;">&#160; </span></span></span><span style="font-family:&quot;color:#353535;font-size:8.5pt;">Medium instance: $0.24 per hour
</p>
<p>   </span></p>
<p style="line-height:10.5pt;text-indent:-18pt;margin-bottom:2.25pt;margin-left:48.75pt;" class="MsoNormal"><span style="font-family:wingdings;color:#353535;font-size:10pt;"><span>§<span style="font:7pt &quot;">&#160; </span></span></span><span style="font-family:&quot;color:#353535;font-size:8.5pt;">Large instance: $0.48 per hour
</p>
<p>   </span></p>
<p style="line-height:10.5pt;text-indent:-18pt;margin-bottom:2.25pt;margin-left:48.75pt;" class="MsoNormal"><span style="font-family:wingdings;color:#353535;font-size:10pt;"><span>§<span style="font:7pt &quot;">&#160; </span></span></span><span style="font-family:&quot;color:#353535;font-size:8.5pt;">Extra large instance: $0.96 per hour
</p>
<p>   </span></p>
<p style="line-height:10.5pt;text-indent:-18pt;margin-bottom:2.25pt;margin-left:30pt;" class="MsoNormal"><span style="font-family:symbol;color:#353535;font-size:10pt;"><span>·<span style="font:7pt &quot;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span></span></span><span style="font-family:&quot;color:#353535;font-size:8.5pt;">Storage
</p>
<p>   </span></p>
<p style="line-height:10.5pt;text-indent:-18pt;margin-bottom:2.25pt;margin-left:48.75pt;" class="MsoNormal"><span style="font-family:wingdings;color:#353535;font-size:10pt;"><span>§<span style="font:7pt &quot;">&#160; </span></span></span><span style="font-family:&quot;color:#353535;font-size:8.5pt;">$0.15 per GB stored per month
</p>
<p>   </span></p>
<p style="line-height:10.5pt;text-indent:-18pt;margin-bottom:2.25pt;margin-left:48.75pt;" class="MsoNormal"><span style="font-family:wingdings;color:#353535;font-size:10pt;"><span>§<span style="font:7pt &quot;">&#160; </span></span></span><span style="font-family:&quot;color:#353535;font-size:8.5pt;">$0.01 per 10,000 storage transactions
</p>
<p>   </span></p>
<p style="line-height:10.5pt;text-indent:-18pt;margin-bottom:2.25pt;margin-left:30pt;" class="MsoNormal"><span style="font-family:symbol;color:#353535;font-size:10pt;"><span>·<span style="font:7pt &quot;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span></span></span><span style="font-family:&quot;color:#353535;font-size:8.5pt;">Content Delivery Network (CDN) (Content Delivery Network (CDN) &#8211; Windows Azure CDN data transfer charges are based on the data center location from where the traffic was served, not based on the end user’s location)
</p>
<p>   </span></p>
<p style="line-height:10.5pt;text-indent:-18pt;margin-bottom:2.25pt;margin-left:48.75pt;" class="MsoNormal"><span style="font-family:wingdings;color:#353535;font-size:10pt;"><span>§<span style="font:7pt &quot;">&#160; </span></span></span><span style="font-family:&quot;color:#353535;font-size:8.5pt;">$0.15 per GB for data transfers from European and North American locations*
</p>
<p>   </span></p>
<p style="line-height:10.5pt;text-indent:-18pt;margin-bottom:2.25pt;margin-left:48.75pt;" class="MsoNormal"><span style="font-family:wingdings;color:#353535;font-size:10pt;"><span>§<span style="font:7pt &quot;">&#160; </span></span></span><span style="font-family:&quot;color:#353535;font-size:8.5pt;">$0.20 per GB for data transfers from other locations*
</p>
<p>   </span></p>
<p style="line-height:10.5pt;text-indent:-18pt;margin-bottom:2.25pt;margin-left:48.75pt;" class="MsoNormal"><span style="font-family:wingdings;color:#353535;font-size:10pt;"><span>§<span style="font:7pt &quot;">&#160; </span></span></span><span style="font-family:&quot;color:#353535;font-size:8.5pt;">$0.01 per 10,000 transactions*
</p>
<p>   </span></p>
<p style="line-height:10.5pt;margin-bottom:12.75pt;" class="MsoNormal"><b><span style="font-family:&quot;color:#353535;font-size:8.5pt;">SQL Azure
</p>
<p>     </span></b></p>
<p style="line-height:10.5pt;text-indent:-18pt;margin-bottom:2.25pt;margin-left:30pt;" class="MsoNormal"><span style="font-family:symbol;color:#353535;font-size:10pt;"><span>·<span style="font:7pt &quot;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span></span></span><span style="font-family:&quot;color:#353535;font-size:8.5pt;">Web Edition
</p>
<p>   </span></p>
<p style="line-height:10.5pt;text-indent:-18pt;margin-bottom:2.25pt;margin-left:48.75pt;" class="MsoNormal"><span style="font-family:wingdings;color:#353535;font-size:10pt;"><span>§<span style="font:7pt &quot;">&#160; </span></span></span><span style="font-family:&quot;color:#353535;font-size:8.5pt;">$9.99 per database up to 1GB per month
</p>
<p>   </span></p>
<p style="line-height:10.5pt;text-indent:-18pt;margin-bottom:2.25pt;margin-left:48.75pt;" class="MsoNormal"><span style="font-family:wingdings;color:#353535;font-size:10pt;"><span>§<span style="font:7pt &quot;">&#160; </span></span></span><span style="font-family:&quot;color:#353535;font-size:8.5pt;">$49.95 per database up to 5GB per month**
</p>
<p>   </span></p>
<p style="line-height:10.5pt;text-indent:-18pt;margin-bottom:2.25pt;margin-left:30pt;" class="MsoNormal"><span style="font-family:symbol;color:#353535;font-size:10pt;"><span>·<span style="font:7pt &quot;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span></span></span><span style="font-family:&quot;color:#353535;font-size:8.5pt;">Business Edition
</p>
<p>   </span></p>
<p style="line-height:10.5pt;text-indent:-18pt;margin-bottom:2.25pt;margin-left:48.75pt;" class="MsoNormal"><span style="font-family:wingdings;color:#353535;font-size:10pt;"><span>§<span style="font:7pt &quot;">&#160; </span></span></span><span style="font-family:&quot;color:#353535;font-size:8.5pt;">$99.99 per database up to 10GB per month**
</p>
<p>   </span></p>
<p style="line-height:10.5pt;text-indent:-18pt;margin-bottom:2.25pt;margin-left:48.75pt;" class="MsoNormal"><span style="font-family:wingdings;color:#353535;font-size:10pt;"><span>§<span style="font:7pt &quot;">&#160; </span></span></span><span style="font-family:&quot;color:#353535;font-size:8.5pt;">$199.98 per database up to 20GB per month**
</p>
<p>   </span></p>
<p style="line-height:10.5pt;text-indent:-18pt;margin-bottom:2.25pt;margin-left:48.75pt;" class="MsoNormal"><span style="font-family:wingdings;color:#353535;font-size:10pt;"><span>§<span style="font:7pt &quot;">&#160; </span></span></span><span style="font-family:&quot;color:#353535;font-size:8.5pt;">$299.97 per database up to 30GB per month**
</p>
<p>   </span></p>
<p style="line-height:10.5pt;text-indent:-18pt;margin-bottom:2.25pt;margin-left:48.75pt;" class="MsoNormal"><span style="font-family:wingdings;color:#353535;font-size:10pt;"><span>§<span style="font:7pt &quot;">&#160; </span></span></span><span style="font-family:&quot;color:#353535;font-size:8.5pt;">$399.96 per database up to 40GB per month**
</p>
<p>   </span></p>
<p style="line-height:10.5pt;text-indent:-18pt;margin-bottom:2.25pt;margin-left:48.75pt;" class="MsoNormal"><span style="font-family:wingdings;color:#353535;font-size:10pt;"><span>§<span style="font:7pt &quot;">&#160; </span></span></span><span style="font-family:&quot;color:#353535;font-size:8.5pt;">$499.95 per database up to 50GB per month**
</p>
<p>   </span></p>
<p style="line-height:10.5pt;margin-bottom:12.75pt;" class="MsoNormal"><b><span style="font-family:&quot;color:#353535;font-size:8.5pt;">AppFabric
</p>
<p>     </span></b></p>
<p style="line-height:10.5pt;text-indent:-18pt;margin-bottom:2.25pt;margin-left:30pt;" class="MsoNormal"><span style="font-family:symbol;color:#353535;font-size:10pt;"><span>·<span style="font:7pt &quot;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span></span></span><span style="font-family:&quot;color:#353535;font-size:8.5pt;">Access Control (</span>provides the ability to create rules and claims for authentication and authorization)<span style="font-family:&quot;color:#353535;font-size:8.5pt;">
</p>
<p>   </span></p>
<p style="line-height:10.5pt;text-indent:-18pt;margin-bottom:2.25pt;margin-left:48.75pt;" class="MsoNormal"><span style="font-family:wingdings;color:#353535;font-size:10pt;"><span>§<span style="font:7pt &quot;">&#160; </span></span></span><span style="font-family:&quot;color:#353535;font-size:8.5pt;">$1.99 per 100,000 transactions
</p>
<p>   </span></p>
<p style="line-height:10.5pt;text-indent:-18pt;margin-bottom:2.25pt;margin-left:30pt;" class="MsoNormal"><span style="font-family:symbol;color:#353535;font-size:10pt;"><span>·<span style="font:7pt &quot;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span></span></span><span style="font-family:&quot;color:#353535;font-size:8.5pt;">Service Bus (</span><span style="font-family:&quot;color:#353535;font-size:8.5pt;">Expose apps and services)</span><span style="font-family:&quot;color:#353535;font-size:8.5pt;">
</p>
<p>   </span></p>
<p style="line-height:10.5pt;text-indent:-18pt;margin-bottom:2.25pt;margin-left:48.75pt;" class="MsoNormal"><span style="font-family:wingdings;color:#353535;font-size:10pt;"><span>§<span style="font:7pt &quot;">&#160; </span></span></span><span style="font-family:&quot;color:#353535;font-size:8.5pt;">$3.99 per connection on a “pay-as-you-go” basis
</p>
<p>   </span></p>
<p style="line-height:10.5pt;text-indent:-18pt;margin-bottom:2.25pt;margin-left:48.75pt;" class="MsoNormal"><span style="font-family:wingdings;color:#353535;font-size:10pt;"><span>§<span style="font:7pt &quot;">&#160; </span></span></span><span style="font-family:&quot;color:#353535;font-size:8.5pt;">Pack of 5 connections $9.95
</p>
<p>   </span></p>
<p style="line-height:10.5pt;text-indent:-18pt;margin-bottom:2.25pt;margin-left:48.75pt;" class="MsoNormal"><span style="font-family:wingdings;color:#353535;font-size:10pt;"><span>§<span style="font:7pt &quot;">&#160; </span></span></span><span style="font-family:&quot;color:#353535;font-size:8.5pt;">Pack of 25 connections $49.75
</p>
<p>   </span></p>
<p style="line-height:10.5pt;text-indent:-18pt;margin-bottom:2.25pt;margin-left:48.75pt;" class="MsoNormal"><span style="font-family:wingdings;color:#353535;font-size:10pt;"><span>§<span style="font:7pt &quot;">&#160; </span></span></span><span style="font-family:&quot;color:#353535;font-size:8.5pt;">Pack of 100 connections $199.00
</p>
<p>   </span></p>
<p style="line-height:10.5pt;text-indent:-18pt;margin-bottom:2.25pt;margin-left:48.75pt;" class="MsoNormal"><span style="font-family:wingdings;color:#353535;font-size:10pt;"><span>§<span style="font:7pt &quot;">&#160; </span></span></span><span style="font-family:&quot;color:#353535;font-size:8.5pt;">Pack of 500 connections $995.00
</p>
<p>   </span></p>
<p style="line-height:10.5pt;margin-bottom:12.75pt;" class="MsoNormal"><span style="font-family:&quot;color:#353535;font-size:8.5pt;">Data Transfers
</p>
<p>   </span></p>
<p style="line-height:10.5pt;text-indent:-18pt;margin-bottom:2.25pt;margin-left:30pt;" class="MsoNormal"><span style="font-family:symbol;color:#353535;font-size:10pt;"><span>·<span style="font:7pt &quot;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span></span></span><span style="font-family:&quot;color:#353535;font-size:8.5pt;">North America and Europe regions
</p>
<p>   </span></p>
<p style="line-height:10.5pt;text-indent:-18pt;margin-bottom:2.25pt;margin-left:48.75pt;" class="MsoNormal"><span style="font-family:wingdings;color:#353535;font-size:10pt;"><span>§<span style="font:7pt &quot;">&#160; </span></span></span><span style="font-family:&quot;color:#353535;font-size:8.5pt;">$0.10 per GB in
</p>
<p>   </span></p>
<p style="line-height:10.5pt;text-indent:-18pt;margin-bottom:2.25pt;margin-left:48.75pt;" class="MsoNormal"><span style="font-family:wingdings;color:#353535;font-size:10pt;"><span>§<span style="font:7pt &quot;">&#160; </span></span></span><span style="font-family:&quot;color:#353535;font-size:8.5pt;">$0.15 per GB out
</p>
<p>   </span></p>
<p style="line-height:10.5pt;text-indent:-18pt;margin-bottom:2.25pt;margin-left:30pt;" class="MsoNormal"><span style="font-family:symbol;color:#353535;font-size:10pt;"><span>·<span style="font:7pt &quot;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span></span></span><span style="font-family:&quot;color:#353535;font-size:8.5pt;">Asia Pacific Region
</p>
<p>   </span></p>
<p style="line-height:10.5pt;text-indent:-18pt;margin-bottom:2.25pt;margin-left:48.75pt;" class="MsoNormal"><span style="font-family:wingdings;color:#353535;font-size:10pt;"><span>§<span style="font:7pt &quot;">&#160; </span></span></span><span style="font-family:&quot;color:#353535;font-size:8.5pt;">$0.30 per GB in
</p>
<p>   </span></p>
<p style="line-height:10.5pt;text-indent:-18pt;margin-bottom:2.25pt;margin-left:48.75pt;" class="MsoNormal"><span style="font-family:wingdings;color:#353535;font-size:10pt;"><span>§<span style="font:7pt &quot;">&#160; </span></span></span><span style="font-family:&quot;color:#353535;font-size:8.5pt;">$0.45 per GB out
</p>
<p>   </span></p>
<p style="line-height:10.5pt;text-indent:-18pt;margin-bottom:2.25pt;margin-left:30pt;" class="MsoNormal"><span style="font-family:symbol;color:#353535;font-size:10pt;"><span>·<span style="font:7pt &quot;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span></span></span><span style="font-family:&quot;color:#353535;font-size:8.5pt;">Inbound data transfers during off-peak times through October 31, 2010 are at no charge. Prices revert to our normal inbound data transfer rates after October 31, 2010.
</p>
<p>   </span></p>
<p class="MsoNormal">
<p>&#160;</p>
</p>
<p class="MsoNormal">
<p>&#160;</p>
</p>
<p class="MsoNormal"><b><span style="line-height:115%;font-size:14pt;">Measuring Windows Azure Consumption
</p>
<p>     </span></b></p>
<p style="text-indent:-18pt;margin-bottom:9.75pt;background:white;margin-left:18.75pt;" class="MsoNormal"><span style="font-family:symbol;color:#353535;font-size:10pt;"><span>·<span style="font:7pt &quot;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span></span></span><b><span style="color:#353535;">Compute time, measured in service hours</span></b><span style="color:#353535;">: Windows Azure compute hours are charged only for when your application is deployed. When developing and testing your application, developers will want to remove the compute instances that are not being used to minimize compute hour billing. Partial compute hours are billed as full hours.
</p>
<p>   </span></p>
<p style="text-indent:-18pt;margin-bottom:9.75pt;background:white;margin-left:18.75pt;" class="MsoNormal"><span style="font-family:symbol;color:#353535;font-size:10pt;"><span>·<span style="font:7pt &quot;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span></span></span><b><span style="color:#353535;">Storage, measured in GB</span></b><span style="color:#353535;">: Storage is metered in units of average daily amount of data stored (in GB) over a monthly period. For example, if a user uploaded 30GB of data and stored it on Windows Azure for a day, her monthly billed storage would be 1 GB. If the same user uploaded 30GB of data and stored it on Windows Azure for an entire billing period, her monthly billed storage would be 30GB. Storage is also metered in terms of storage transactions used to add, update, read and delete storage data. These are billed at a rate of $0.01 for 10,000 (10k) transaction requests
</p>
<p>   </span></p>
<p style="text-indent:-18pt;margin-bottom:9.75pt;background:white;margin-left:18.75pt;" class="MsoNormal"><span style="font-family:symbol;color:#353535;font-size:10pt;"><span>·<span style="font:7pt &quot;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span></span></span><b><span style="color:#353535;">Data transfers measured in GB (transmissions to and from the Windows Azure datacenter)</span></b><span style="color:#353535;">: Data transfers are charged based on the total amount of data going in and out of the Azure services via the internet in a given 30-day period. Data transfers within a sub region are free.
</p>
<p>   </span></p>
<p style="text-indent:-18pt;background:white;margin-left:18.75pt;" class="MsoNormal"><span style="font-family:symbol;color:#353535;font-size:10pt;"><span>·<span style="font:7pt &quot;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span></span></span><b><span style="color:#353535;">Transactions</span></b><span style="color:#353535;">, measured as application requests.
</p>
<p>   </span></p>
<p class="MsoNormal">
<p>&#160;</p>
</p>
<p class="MsoNormal"><b><span style="line-height:115%;font-size:14pt;">Calculate connection count for service bus
</p>
<p>     </span></b></p>
<p class="MsoNormal"><span>A “connection” is established whether the service binds to the AppFabric Service Bus, and also when a client(s) bind to the cloud endpoint.<span>&#160; </span>So if I have a development application and press F5 in Visual Studio, when my service and client bind to the cloud that counts as 2 “connections.”
</p>
<p>   </span></p>
<p class="MsoNormal"><span>Pay for the <strong><span style="font-family:&quot;">maximum number of Connections that were in simultaneous use on any given day</span></strong> during the billing period.
</p>
<p>   </span></p>
<p class="MsoNormal"><span>For example, a given client application may open and close a single Connection many times during a day; this is especially likely if an HTTP binding is used. To the target system, this might appear to be separate, discrete Connections, however to the customer this is a single intermittent Connection. Charging based on simultaneous Connection usage ensures that <strong><span style="font-family:&quot;">a customer would not be billed multiple times for a single intermittent Connection
</p>
<p>       </span></strong></span></p>
<p class="MsoNormal"><strong><span style="font-family:&quot;">
<p>&#160;</p>
<p>     </span></strong></p>
<p class="MsoNormal"><strong><span style="font-family:&quot;">
<p>&#160;</p>
<p>     </span></strong></p>
<p class="MsoNormal"><strong><span style="font-family:&quot;">References
</p>
<p>     </span></strong></p>
<p class="MsoNormal"><a href="http://en.wikipedia.org/wiki/Cloud_computing"><span>http://en.wikipedia.org/wiki/Cloud_computing</span></a><span>
</p>
<p>   </span></p>
<p class="MsoNormal"><a href="http://www.microsoft.com/windowsazure/pricing/"><span>http://www.microsoft.com/windowsazure/pricing/</span></a><span>
</p>
<p>   </span></p>
<p class="MsoNormal"><a href="http://seroter.wordpress.com/2010/04/14/how-do-you-figure-out-the-cost-of-using-the-azure-appfabric-service-bus/"><span>http://seroter.wordpress.com/2010/04/14/how-do-you-figure-out-the-cost-of-using-the-azure-appfabric-service-bus/</span></a><span>
</p>
<p>   </span></p>
<p class="MsoNormal"><a href="http://www.microsoft.com/windowsazure/faq/"><span>http://www.microsoft.com/windowsazure/faq/</span></a><span>
</p>
<p>   </span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/miteshisheth.wordpress.com/234/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/miteshisheth.wordpress.com/234/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/miteshisheth.wordpress.com/234/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/miteshisheth.wordpress.com/234/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/miteshisheth.wordpress.com/234/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/miteshisheth.wordpress.com/234/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/miteshisheth.wordpress.com/234/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/miteshisheth.wordpress.com/234/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/miteshisheth.wordpress.com/234/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/miteshisheth.wordpress.com/234/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/miteshisheth.wordpress.com/234/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/miteshisheth.wordpress.com/234/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/miteshisheth.wordpress.com/234/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/miteshisheth.wordpress.com/234/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=miteshisheth.wordpress.com&amp;blog=8485788&amp;post=234&amp;subd=miteshisheth&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://miteshisheth.wordpress.com/2010/07/27/windows-azure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bf7c284e28c7cddce77364c96cbb203c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">miteshisheth</media:title>
		</media:content>
	</item>
		<item>
		<title>Simple example for how to host or deploy the Web Site.</title>
		<link>http://miteshisheth.wordpress.com/2010/05/07/simple-example-for-how-to-host-or-deploy-the-web-site/</link>
		<comments>http://miteshisheth.wordpress.com/2010/05/07/simple-example-for-how-to-host-or-deploy-the-web-site/#comments</comments>
		<pubDate>Fri, 07 May 2010 06:46:05 +0000</pubDate>
		<dc:creator>miteshisheth</dc:creator>
				<category><![CDATA[Tipes]]></category>

		<guid isPermaLink="false">https://miteshisheth.wordpress.com/2010/05/07/simple-example-for-how-to-host-or-deploy-the-web-site/</guid>
		<description><![CDATA[Now with the help of WebDeploymentSetup provided by Microsoft, web deployment is very easy. You can download it from following path. http://www.microsoft.com/downloads/details.aspx?familyId=0AA30AE8-C73B-4BDD-BB1B-FE697256C459&#38;displaylang=en Install the WebDeploymentSetup.msi. Now follow the following steps. First Create one Web Site. (Not a Web Application) Right click on Web Site. You will get “Add Web Deployment Project” tab, click on it. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=miteshisheth.wordpress.com&amp;blog=8485788&amp;post=231&amp;subd=miteshisheth&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Now with the help of WebDeploymentSetup provided by Microsoft, web deployment is very easy.</p>
<p>You can download it from following path.</p>
<p><a title="http://www.microsoft.com/downloads/details.aspx?familyId=0AA30AE8-C73B-4BDD-BB1B-FE697256C459&amp;displaylang=en" href="http://www.microsoft.com/downloads/details.aspx?familyId=0AA30AE8-C73B-4BDD-BB1B-FE697256C459&amp;displaylang=en">http://www.microsoft.com/downloads/details.aspx?familyId=0AA30AE8-C73B-4BDD-BB1B-FE697256C459&amp;displaylang=en</a></p>
<p>Install the WebDeploymentSetup.msi. Now follow the following steps.</p>
<ol>
<li>First Create one Web Site. (Not a Web Application) </li>
<li>Right click on Web Site. You will get “Add Web Deployment Project” tab, click on it.      <br /><a href="http://miteshisheth.files.wordpress.com/2010/05/image.png"><img title="image" style="display:inline;border-width:0;" height="175" alt="image" src="http://miteshisheth.files.wordpress.com/2010/05/image_thumb.png?w=232&#038;h=175" width="232" border="0" /></a> </li>
<li>Click on “Add Web Deployment Project”, it will create one more project in solution.      <br /><a href="http://miteshisheth.files.wordpress.com/2010/05/image1.png"><img title="image" style="display:inline;border-width:0;" height="151" alt="image" src="http://miteshisheth.files.wordpress.com/2010/05/image_thumb1.png?w=335&#038;h=151" width="335" border="0" /></a>&#160;<a href="http://miteshisheth.files.wordpress.com/2010/05/image2.png"><img title="image" style="display:inline;border-width:0;" height="190" alt="image" src="http://miteshisheth.files.wordpress.com/2010/05/image_thumb2.png?w=244&#038;h=190" width="244" border="0" /></a> </li>
</ol>
<p>4.&#160; Now build the WebSite2_deploy project.</p>
<p>5. Now Click on solution and select the WEB Deployment Project. </p>
<p><a href="http://miteshisheth.files.wordpress.com/2010/05/image3.png"><img title="image" style="display:inline;border-width:0;" height="242" alt="image" src="http://miteshisheth.files.wordpress.com/2010/05/image_thumb3.png?w=361&#038;h=242" width="361" border="0" /></a> </p>
<p>6. You will get following screen.</p>
<p><a href="http://miteshisheth.files.wordpress.com/2010/05/image4.png"><img title="image" style="display:inline;border-width:0;" height="109" alt="image" src="http://miteshisheth.files.wordpress.com/2010/05/image_thumb4.png?w=214&#038;h=109" width="214" border="0" /></a> </p>
</p>
</p>
<p>7. Right click on “Web Application Folder” and click on “Add” and Select “Prolect Output” tab.</p>
<p><a href="http://miteshisheth.files.wordpress.com/2010/05/image5.png"><img title="image" style="display:inline;border-width:0;" height="143" alt="image" src="http://miteshisheth.files.wordpress.com/2010/05/image_thumb5.png?w=342&#038;h=143" width="342" border="0" /></a> </p>
<p>8. Once we click on “Project Output”. Following window prompt. Select our WebSite2_deploy project (Which we have created using WebDeploymentSetup.msi)</p>
<p>9. Now build the project and check that in folder. Now .msi file will be there. Click on .msi file.</p>
<p>10 Now it will ask for the Virtual directory , in IIS.&#160; If you have server, you can even create the site and give the Virtual directory. In client computer, allow only to create virtual directory.</p>
<p><a href="http://miteshisheth.files.wordpress.com/2010/05/image6.png"><img title="image" style="display:inline;border-width:0;" height="250" alt="image" src="http://miteshisheth.files.wordpress.com/2010/05/image_thumb6.png?w=300&#038;h=250" width="300" border="0" /></a> </p>
<p>11 Select the appropriate virtual directory and finish the installation.</p>
<p>12. Now if you check in IIS, you will get the “websetup1_man_deploy” virtual directory. </p>
<p>&#160;</p>
<p>This is the easiest way to host web site into IIS using .msi…..&#160;&#160; </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/miteshisheth.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/miteshisheth.wordpress.com/231/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/miteshisheth.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/miteshisheth.wordpress.com/231/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/miteshisheth.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/miteshisheth.wordpress.com/231/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/miteshisheth.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/miteshisheth.wordpress.com/231/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/miteshisheth.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/miteshisheth.wordpress.com/231/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/miteshisheth.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/miteshisheth.wordpress.com/231/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/miteshisheth.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/miteshisheth.wordpress.com/231/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=miteshisheth.wordpress.com&amp;blog=8485788&amp;post=231&amp;subd=miteshisheth&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://miteshisheth.wordpress.com/2010/05/07/simple-example-for-how-to-host-or-deploy-the-web-site/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bf7c284e28c7cddce77364c96cbb203c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">miteshisheth</media:title>
		</media:content>

		<media:content url="http://miteshisheth.files.wordpress.com/2010/05/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://miteshisheth.files.wordpress.com/2010/05/image_thumb1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://miteshisheth.files.wordpress.com/2010/05/image_thumb2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://miteshisheth.files.wordpress.com/2010/05/image_thumb3.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://miteshisheth.files.wordpress.com/2010/05/image_thumb4.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://miteshisheth.files.wordpress.com/2010/05/image_thumb5.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://miteshisheth.files.wordpress.com/2010/05/image_thumb6.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>Useful Commands for Remote Server</title>
		<link>http://miteshisheth.wordpress.com/2010/05/06/useful-commands-for-remote-server/</link>
		<comments>http://miteshisheth.wordpress.com/2010/05/06/useful-commands-for-remote-server/#comments</comments>
		<pubDate>Thu, 06 May 2010 10:59:26 +0000</pubDate>
		<dc:creator>miteshisheth</dc:creator>
				<category><![CDATA[Tipes]]></category>

		<guid isPermaLink="false">https://miteshisheth.wordpress.com/2010/05/06/useful-commands-for-remote-server/</guid>
		<description><![CDATA[Sometimes you have urgency to access the server but server’s logging capacity is over. It means once any existing session log off, new user can enter. 1. To know how many session’s are active in the remote server. &#160; c:/&#62; qwinsta /server:&#60;&#60;Server Name / IP address&#62;&#62; Once you know the session, kill the session or [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=miteshisheth.wordpress.com&amp;blog=8485788&amp;post=215&amp;subd=miteshisheth&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Sometimes you have urgency to access the server but server’s logging capacity is over. It means once any existing session log off, new user can enter.</p>
<p>1. <strong>To know how many session’s are active in the remote server.     <br /></strong>&#160; <font color="#0000ff"> c:/&gt; qwinsta /server:&lt;&lt;Server Name / IP address&gt;&gt;</font></p>
<blockquote><p><strong>Once you know the session, kill the session or logoff the remote computer.</strong></p>
<p><strong>using following command, we can kill the session</strong></p>
<p><font color="#0080ff">c:/&gt; rwinsta {sessionname | sessionid} /SERVER:servername       <br /></font></p>
<p><font color="#000000"><strong>using following command, we can logoff the remote machine.</strong></font></p>
<p>C:\&gt;logoff /server:&lt;&lt;ServerName&gt;&gt; 1 /v     <br />Logging off session ID 1</p>
</blockquote>
<p> <font color="#0080ff"></font>
<p>2. <strong>Forcefully logging into the remote computer</strong>    <br />&#160;&#160; <font color="#0080ff">c:/&gt; mstsc -v:&lt;&lt;ServerName&gt;&gt; /F –console</font></p>
<p>3.&#160; <strong>Check for a list of running sessions by typing the following only on the server. we can call this Query where the Terminal services are available ;     <br /></strong>&#160; <font color="#0000ff"> c:/&gt; QUERY USER /SERVER:servername</font>    </p>
<p>4. <strong>This will list all current session on that server. Record the session ID for the session you want to kill.&#160; Then</strong>    <br />&#160; <font color="#0000ff">c:/&gt; RESET SESSION sessionID /SERVER:servername</font></p>
<p><font color="#0000ff"><font color="#000000">For more reference read the following blog.</font> </font><a title="http://ts.veranoest.net/ts_faq_administration.htm" href="http://ts.veranoest.net/ts_faq_administration.htm">http://ts.veranoest.net/ts_faq_administration.htm</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/miteshisheth.wordpress.com/215/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/miteshisheth.wordpress.com/215/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/miteshisheth.wordpress.com/215/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/miteshisheth.wordpress.com/215/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/miteshisheth.wordpress.com/215/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/miteshisheth.wordpress.com/215/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/miteshisheth.wordpress.com/215/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/miteshisheth.wordpress.com/215/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/miteshisheth.wordpress.com/215/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/miteshisheth.wordpress.com/215/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/miteshisheth.wordpress.com/215/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/miteshisheth.wordpress.com/215/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/miteshisheth.wordpress.com/215/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/miteshisheth.wordpress.com/215/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=miteshisheth.wordpress.com&amp;blog=8485788&amp;post=215&amp;subd=miteshisheth&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://miteshisheth.wordpress.com/2010/05/06/useful-commands-for-remote-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bf7c284e28c7cddce77364c96cbb203c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">miteshisheth</media:title>
		</media:content>
	</item>
		<item>
		<title>SSRS : First simple example :  How to use Sql Server Reporting Service and How to display report into Windows Application</title>
		<link>http://miteshisheth.wordpress.com/2010/04/29/ssrs-first-simple-example-how-to-use-sql-server-reporting-service-and-how-to-display-report-into-windows-application/</link>
		<comments>http://miteshisheth.wordpress.com/2010/04/29/ssrs-first-simple-example-how-to-use-sql-server-reporting-service-and-how-to-display-report-into-windows-application/#comments</comments>
		<pubDate>Thu, 29 Apr 2010 12:13:26 +0000</pubDate>
		<dc:creator>miteshisheth</dc:creator>
				<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">https://miteshisheth.wordpress.com/2010/04/29/ssrs-first-simple-example-how-to-use-sql-server-reporting-service-and-how-to-display-report-into-windows-application/</guid>
		<description><![CDATA[Create the Report 1. Create new Project of Business Intelligence Projects –&#62; Report Server Project 2. After that, click on Solution Explore, right click on “Shared Data Source” and create Data Source for the report. 3. Once Data Source is created, Again right click and Add the report. This is first time so I can [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=miteshisheth.wordpress.com&amp;blog=8485788&amp;post=213&amp;subd=miteshisheth&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><font color="#0080ff" size="3"><strong>Create the Report</strong></font></p>
<p>1. Create new Project of Business Intelligence Projects –&gt; Report Server Project   </p>
<p><a href="http://miteshisheth.files.wordpress.com/2010/04/image.png"><img title="image" style="border-right:0;border-top:0;display:inline;border-left:0;border-bottom:0;" height="335" alt="image" src="http://miteshisheth.files.wordpress.com/2010/04/image_thumb.png?w=447&#038;h=335" width="447" border="0" /></a> </p>
<p>2. After that, click on Solution Explore, right click on “Shared Data Source” and create Data Source for the report.</p>
<p><a href="http://miteshisheth.files.wordpress.com/2010/04/image1.png"><img title="image" style="border-right:0;border-top:0;display:inline;border-left:0;border-bottom:0;" height="299" alt="image" src="http://miteshisheth.files.wordpress.com/2010/04/image_thumb1.png?w=394&#038;h=299" width="394" border="0" /></a> </p>
</p>
<p>3. Once Data Source is created, Again right click and Add the report. This is first time so I can explain using Wizard.   </p>
<p>4. During the wizard, give the query so it will create “Data Set” for the report.</p>
<p>5. After finishing the wizard, now we can see the report on screen, click on “Preview”. if table has data , it will display.</p>
<p>&#160;</p>
<p><a href="http://miteshisheth.files.wordpress.com/2010/04/image2.png"><img title="image" style="border-right:0;border-top:0;display:inline;border-left:0;border-bottom:0;" height="292" alt="image" src="http://miteshisheth.files.wordpress.com/2010/04/image_thumb2.png?w=511&#038;h=292" width="511" border="0" /></a> </p>
<p>Now this is the way to create simple report. The challenge is to set the “Reporting Server” and host the report to the server and run the report on the Windows / Web application.</p>
<p>Now I’ll explain how to set the “Reporting Services”</p>
<p><font color="#0080ff" size="3"><strong>Configure the Reporting Server</strong></font></p>
<p>1. Open All Programs –&gt; Microsoft SQL 2008 –&gt; Configuration Tool –&gt; Reporting Service Confige&#160; Manager </p>
<p>you will get following screen</p>
<p><a href="http://miteshisheth.files.wordpress.com/2010/04/image3.png"><img title="image" style="border-right:0;border-top:0;display:inline;border-left:0;border-bottom:0;" height="397" alt="image" src="http://miteshisheth.files.wordpress.com/2010/04/image_thumb3.png?w=502&#038;h=397" width="502" border="0" /></a> </p>
</p>
<p>2. Above is the Configuration tool to set the “Reporting Services”</p>
<p>If we click on “Web Service URL” tab, we will get the WEB url to access our server.</p>
<p>Now we have set the server. Now we will deploy our report to the server.</p>
<p><font color="#0080ff" size="3"><strong>Deploy Report into the Reporting Server</strong></font>&#160;</p>
<p> 1. Go back to our solution which we have created. </p>
<p>2. Right Click to solution and click on Property. We have to set “TargetServerURL” property to our server. (URL of our reporting server)</p>
<p>2. Right click on solution and click on Deploy tab.</p>
<p><a href="http://miteshisheth.files.wordpress.com/2010/04/image4.png"><img title="image" style="border-right:0;border-top:0;display:inline;border-left:0;border-bottom:0;" height="326" alt="image" src="http://miteshisheth.files.wordpress.com/2010/04/image_thumb4.png?w=301&#038;h=326" width="301" border="0" /></a> </p>
<p>3. check on URL, now we will get one report hosted.</p>
<p>Now we have finished the hosting of report into the server. </p>
<p>Only one part is remaining and that is to display report into the WEB/WINDOWS application.</p>
<p><font color="#0080ff" size="3"><strong>Display report into the WEB/WINDOWS application</strong></font></p>
<p><font color="#000000" size="2">1. Create the Windows Application and dreg MicrosoftReportViewer form the tool box.</font></p>
<p><font color="#000000" size="2">2. Right click on the MicrosoftReportViewer and select the Property.</font></p>
<p><font color="#000000" size="2">3. We have to set 2 property to get the report which is hosted in our “Reporting Server”.</font></p>
<blockquote><p><font color="#000000" size="2">ReportPath :- Path of the report into the report server</font></p>
<p><font color="#000000" size="2">ReportServerURL : The URL of our “reporting Server”</font></p>
</blockquote>
<p><a href="http://miteshisheth.files.wordpress.com/2010/04/image5.png"><img title="image" style="border-right:0;border-top:0;display:inline;border-left:0;border-bottom:0;" height="179" alt="image" src="http://miteshisheth.files.wordpress.com/2010/04/image_thumb5.png?w=451&#038;h=179" width="451" border="0" /></a> </p>
<p><strong><font color="#000000" size="2">Run the windows application, it will connect the server which we mention in “ReportServerURL “ property and execute the report which we mention in “ReportPath “ property.</font></strong></p>
<p><a href="http://miteshisheth.files.wordpress.com/2010/04/image6.png"><img title="image" style="border-right:0;border-top:0;display:inline;border-left:0;border-bottom:0;" height="127" alt="image" src="http://miteshisheth.files.wordpress.com/2010/04/image_thumb6.png?w=297&#038;h=127" width="297" border="0" /></a> </p>
<p>I hope , this article may useful for the new person who wants to start SSRS. </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/miteshisheth.wordpress.com/213/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/miteshisheth.wordpress.com/213/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/miteshisheth.wordpress.com/213/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/miteshisheth.wordpress.com/213/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/miteshisheth.wordpress.com/213/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/miteshisheth.wordpress.com/213/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/miteshisheth.wordpress.com/213/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/miteshisheth.wordpress.com/213/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/miteshisheth.wordpress.com/213/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/miteshisheth.wordpress.com/213/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/miteshisheth.wordpress.com/213/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/miteshisheth.wordpress.com/213/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/miteshisheth.wordpress.com/213/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/miteshisheth.wordpress.com/213/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=miteshisheth.wordpress.com&amp;blog=8485788&amp;post=213&amp;subd=miteshisheth&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://miteshisheth.wordpress.com/2010/04/29/ssrs-first-simple-example-how-to-use-sql-server-reporting-service-and-how-to-display-report-into-windows-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bf7c284e28c7cddce77364c96cbb203c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">miteshisheth</media:title>
		</media:content>

		<media:content url="http://miteshisheth.files.wordpress.com/2010/04/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://miteshisheth.files.wordpress.com/2010/04/image_thumb1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://miteshisheth.files.wordpress.com/2010/04/image_thumb2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://miteshisheth.files.wordpress.com/2010/04/image_thumb3.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://miteshisheth.files.wordpress.com/2010/04/image_thumb4.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://miteshisheth.files.wordpress.com/2010/04/image_thumb5.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://miteshisheth.files.wordpress.com/2010/04/image_thumb6.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>Tips for SQL</title>
		<link>http://miteshisheth.wordpress.com/2010/04/21/tips-for-sql/</link>
		<comments>http://miteshisheth.wordpress.com/2010/04/21/tips-for-sql/#comments</comments>
		<pubDate>Wed, 21 Apr 2010 12:55:14 +0000</pubDate>
		<dc:creator>miteshisheth</dc:creator>
				<category><![CDATA[Tipes]]></category>

		<guid isPermaLink="false">http://miteshisheth.wordpress.com/2010/04/21/tips-for-sql/</guid>
		<description><![CDATA[How to find the lock table in sql 2008? Select&#160;&#160; &#160;&#160;&#160; object_name(P.object_id) as TableName,&#160; &#160;&#160;&#160; resource_type, resource_description from &#160;&#160;&#160; sys.dm_tran_locks L &#160;&#160;&#160; join sys.partitions P on L.resource_associated_entity_id = p.hobt_id &#160; Other way to get the lock object select * from sys.objects where name =&#8217;&#60;&#60;Table Name &#62;&#62;&#8217; &#8211;You will get object id for table(2081546599 sp_lock&#160; &#8212; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=miteshisheth.wordpress.com&amp;blog=8485788&amp;post=196&amp;subd=miteshisheth&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>How to find the lock table in sql 2008?</strong></p>
<p><font color="#0080ff">Select&#160;&#160; <br />&#160;&#160;&#160; object_name(P.object_id) as TableName,&#160; <br />&#160;&#160;&#160; resource_type, resource_description       <br />from       <br />&#160;&#160;&#160; sys.dm_tran_locks L       <br />&#160;&#160;&#160; join sys.partitions P on L.resource_associated_entity_id = p.hobt_id</font></p>
<p>&#160;</p>
<p><strong>Other way to get the lock object</strong></p>
<p><font color="#0080ff">select * from sys.objects where name =&#8217;&lt;&lt;Table Name &gt;&gt;&#8217;</font></p>
<p> &#8211;You will get object id for table(2081546599</p>
<p><font color="#0080ff">sp_lock</font>&#160; &#8212; it gives number of records, find out the exact number&#160; ex. 2081546599 from the records and kill them following way</p>
<p><font color="#0080ff">kill 53</font></p>
<p><font color="#0080ff">kill 71</font></p>
<p><font color="#0080ff"></font></p>
<p><strong><font color="#000000">How to use the Link server using query?</font></strong></p>
<p><font color="#000000"></font></p>
<p><font color="#000000">&#160;</font></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/miteshisheth.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/miteshisheth.wordpress.com/196/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/miteshisheth.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/miteshisheth.wordpress.com/196/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/miteshisheth.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/miteshisheth.wordpress.com/196/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/miteshisheth.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/miteshisheth.wordpress.com/196/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/miteshisheth.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/miteshisheth.wordpress.com/196/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/miteshisheth.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/miteshisheth.wordpress.com/196/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/miteshisheth.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/miteshisheth.wordpress.com/196/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=miteshisheth.wordpress.com&amp;blog=8485788&amp;post=196&amp;subd=miteshisheth&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://miteshisheth.wordpress.com/2010/04/21/tips-for-sql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bf7c284e28c7cddce77364c96cbb203c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">miteshisheth</media:title>
		</media:content>
	</item>
		<item>
		<title>Linq to XML</title>
		<link>http://miteshisheth.wordpress.com/2010/01/22/linq-to-xml/</link>
		<comments>http://miteshisheth.wordpress.com/2010/01/22/linq-to-xml/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 16:21:29 +0000</pubDate>
		<dc:creator>miteshisheth</dc:creator>
				<category><![CDATA[LINQ]]></category>

		<guid isPermaLink="false">http://miteshisheth.wordpress.com/2010/01/22/linq-to-xml/</guid>
		<description><![CDATA[Generally I don’t like to do XML programming due to all the XPath and etc…. But now due to LINQ to XML , it is very easy and interesting… &#160; Suppose you have following XML. Now we can create xml using XElement (System.Xml.Linq;)object. Following is the code to create the XML.. This is the simplest [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=miteshisheth.wordpress.com&amp;blog=8485788&amp;post=191&amp;subd=miteshisheth&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Generally I don’t like to do XML programming due to all the XPath and etc….</p>
<p>But now due to LINQ to XML , it is very easy and interesting…</p>
<p>&#160;</p>
<p>Suppose you have following XML. Now we can create xml using XElement (System.Xml.Linq;)object. Following is the code to create the XML..</p>
<p>This is the simplest from just for understanding .. </p>
<div style="padding:5px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:74aab4f8-352d-4962-94e0-603787c9462e" class="wlWriterEditableSmartContent">
<div style="border:#000080 1px solid;font-family:'Courier New', Courier, Monospace;font-size:10pt;">
<div style="background:#000080;color:#fff;font-family:Verdana, Tahoma, Arial, sans-serif;font-weight:bold;padding:2px 5px;">Code Snippet</div>
<div style="background:#ddd;max-height:300px;overflow:auto;padding:0;">
<ol style="background:#ffffff;white-space:wrap;margin:0 0 0 25px;">
<li> <span style="color:#2b91af;">XElement</span> con = <span style="color:#0000ff;">new</span> <span style="color:#2b91af;">XElement</span>(<span style="color:#a31515;">&#8220;Contracts&#8221;</span>,</li>
<li style="background:#f3f3f3;">                                     <span style="color:#0000ff;">new</span> <span style="color:#2b91af;">XElement</span>(<span style="color:#a31515;">&#8220;Contact&#8221;</span>, <span style="color:#0000ff;">new</span> <span style="color:#2b91af;">XAttribute</span>(<span style="color:#a31515;">&#8220;IsPermmenet&#8221;</span>, <span style="color:#a31515;">&#8220;True&#8221;</span>),</li>
<li>                                         <span style="color:#0000ff;">new</span> <span style="color:#2b91af;">XElement</span>(<span style="color:#a31515;">&#8220;Office&#8221;</span>, <span style="color:#0000ff;">new</span> <span style="color:#2b91af;">XElement</span>(<span style="color:#a31515;">&#8220;Add1&#8243;</span>, <span style="color:#a31515;">&#8220;Simanhar&#8221;</span>), <span style="color:#0000ff;">new</span> <span style="color:#2b91af;">XElement</span>(<span style="color:#a31515;">&#8220;City&#8221;</span>, <span style="color:#a31515;">&#8220;Ahd&#8221;</span>)),<span style="color:#0000ff;">new</span> <span style="color:#2b91af;">XElement</span>(<span style="color:#a31515;">&#8220;Home&#8221;</span>,<span style="color:#0000ff;">new</span> <span style="color:#2b91af;">XElement</span>(<span style="color:#a31515;">&#8220;Add1&#8243;</span>,<span style="color:#a31515;">&#8220;ssss&#8221;</span>),<span style="color:#0000ff;">new</span> <span style="color:#2b91af;">XElement</span>(<span style="color:#a31515;">&#8220;City&#8221;</span>,<span style="color:#a31515;">&#8220;AHD&#8221;</span>))),</li>
<li style="background:#f3f3f3;">                                     <span style="color:#0000ff;">new</span> <span style="color:#2b91af;">XElement</span>(<span style="color:#a31515;">&#8220;Contact&#8221;</span>, <span style="color:#0000ff;">new</span> <span style="color:#2b91af;">XAttribute</span>(<span style="color:#a31515;">&#8220;IsPermmenet&#8221;</span>, <span style="color:#a31515;">&#8220;false&#8221;</span>),</li>
<li>                                         <span style="color:#0000ff;">new</span> <span style="color:#2b91af;">XElement</span>(<span style="color:#a31515;">&#8220;Office&#8221;</span>, <span style="color:#0000ff;">new</span> <span style="color:#2b91af;">XElement</span>(<span style="color:#a31515;">&#8220;Add1&#8243;</span>, <span style="color:#a31515;">&#8220;JayNagar&#8221;</span>), <span style="color:#0000ff;">new</span> <span style="color:#2b91af;">XElement</span>(<span style="color:#a31515;">&#8220;City&#8221;</span>, <span style="color:#a31515;">&#8220;BNG&#8221;</span>)),<span style="color:#0000ff;">new</span> <span style="color:#2b91af;">XElement</span>(<span style="color:#a31515;">&#8220;Home&#8221;</span>,<span style="color:#0000ff;">new</span> <span style="color:#2b91af;">XElement</span>(<span style="color:#a31515;">&#8220;Add1&#8243;</span>,<span style="color:#a31515;">&#8220;pppp&#8221;</span>),<span style="color:#0000ff;">new</span> <span style="color:#2b91af;">XElement</span>(<span style="color:#a31515;">&#8220;City&#8221;</span>,<span style="color:#a31515;">&#8220;BNG&#8221;</span>))));</li>
<li style="background:#f3f3f3;"> </li>
</ol>
</div>
</div>
</div>
<p>&#160;</p>
<blockquote><p>&lt;Contracts&gt;      <br />&#160; &lt;Contact IsPermanent=&quot;True&quot;&gt;       <br />&#160;&#160;&#160; &lt;Office&gt;       <br />&#160;&#160;&#160;&#160;&#160; &lt;Add1&gt;Simanhar&lt;/Add1&gt;       <br />&#160;&#160;&#160;&#160;&#160; &lt;City&gt;Ahd&lt;/City&gt;       <br />&#160;&#160;&#160; &lt;/Office&gt;       <br />&#160;&#160;&#160; &lt;Home&gt;       <br />&#160;&#160;&#160;&#160;&#160; &lt;Add1&gt;ssss&lt;/Add1&gt;       <br />&#160;&#160;&#160;&#160;&#160; &lt;City&gt;AHD&lt;/City&gt;       <br />&#160;&#160;&#160; &lt;/Home&gt;       <br />&#160; &lt;/Contact&gt;       <br />&#160; &lt;Contact IsPermanent=&quot;false&quot;&gt;       <br />&#160;&#160;&#160; &lt;Office&gt;       <br />&#160;&#160;&#160;&#160;&#160; &lt;Add1&gt;JayNagar&lt;/Add1&gt;       <br />&#160;&#160;&#160;&#160;&#160; &lt;City&gt;BNG&lt;/City&gt;       <br />&#160;&#160;&#160; &lt;/Office&gt;       <br />&#160;&#160;&#160; &lt;Home&gt;       <br />&#160;&#160;&#160;&#160;&#160; &lt;Add1&gt;pppp&lt;/Add1&gt;       <br />&#160;&#160;&#160;&#160;&#160; &lt;City&gt;BNG&lt;/City&gt;       <br />&#160;&#160;&#160; &lt;/Home&gt;       <br />&#160; &lt;/Contact&gt;       <br />&lt;/Contracts&gt;</p>
</blockquote>
<p>Now we can write the LINQ for above xml.</p>
<div style="padding:5px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:e47c73c1-cf6f-4f9f-9c53-85739eb0bbb9" class="wlWriterEditableSmartContent">
<div style="border:#000080 1px solid;font-family:'Courier New', Courier, Monospace;font-size:10pt;">
<div style="background:#000080;color:#fff;font-family:Verdana, Tahoma, Arial, sans-serif;font-weight:bold;padding:2px 5px;">Code Snippet</div>
<div style="background:#ddd;max-height:300px;overflow:auto;padding:0;">
<ol style="background:#ffffff;white-space:wrap;margin:0 0 0 35px;">
<li> <span style="color:#2b91af;">XElement</span> con = <span style="color:#0000ff;">new</span> <span style="color:#2b91af;">XElement</span>(<span style="color:#a31515;">&#8220;Contracts&#8221;</span>,</li>
<li style="background:#f3f3f3;">                                     <span style="color:#0000ff;">new</span> <span style="color:#2b91af;">XElement</span>(<span style="color:#a31515;">&#8220;Contact&#8221;</span>, <span style="color:#0000ff;">new</span> <span style="color:#2b91af;">XAttribute</span>(<span style="color:#a31515;">&#8220;IsPermmenet&#8221;</span>, <span style="color:#a31515;">&#8220;True&#8221;</span>),</li>
<li>                                         <span style="color:#0000ff;">new</span> <span style="color:#2b91af;">XElement</span>(<span style="color:#a31515;">&#8220;Office&#8221;</span>, <span style="color:#0000ff;">new</span> <span style="color:#2b91af;">XElement</span>(<span style="color:#a31515;">&#8220;Add1&#8243;</span>, <span style="color:#a31515;">&#8220;Simanhar&#8221;</span>), <span style="color:#0000ff;">new</span> <span style="color:#2b91af;">XElement</span>(<span style="color:#a31515;">&#8220;City&#8221;</span>, <span style="color:#a31515;">&#8220;Ahd&#8221;</span>)),<span style="color:#0000ff;">new</span> <span style="color:#2b91af;">XElement</span>(<span style="color:#a31515;">&#8220;Home&#8221;</span>,<span style="color:#0000ff;">new</span> <span style="color:#2b91af;">XElement</span>(<span style="color:#a31515;">&#8220;Add1&#8243;</span>,<span style="color:#a31515;">&#8220;ssss&#8221;</span>),<span style="color:#0000ff;">new</span> <span style="color:#2b91af;">XElement</span>(<span style="color:#a31515;">&#8220;City&#8221;</span>,<span style="color:#a31515;">&#8220;AHD&#8221;</span>))),</li>
<li style="background:#f3f3f3;">                                     <span style="color:#0000ff;">new</span> <span style="color:#2b91af;">XElement</span>(<span style="color:#a31515;">&#8220;Contact&#8221;</span>, <span style="color:#0000ff;">new</span> <span style="color:#2b91af;">XAttribute</span>(<span style="color:#a31515;">&#8220;IsPermmenet&#8221;</span>, <span style="color:#a31515;">&#8220;false&#8221;</span>),</li>
<li>                                         <span style="color:#0000ff;">new</span> <span style="color:#2b91af;">XElement</span>(<span style="color:#a31515;">&#8220;Office&#8221;</span>, <span style="color:#0000ff;">new</span> <span style="color:#2b91af;">XElement</span>(<span style="color:#a31515;">&#8220;Add1&#8243;</span>, <span style="color:#a31515;">&#8220;JayNagar&#8221;</span>), <span style="color:#0000ff;">new</span> <span style="color:#2b91af;">XElement</span>(<span style="color:#a31515;">&#8220;City&#8221;</span>, <span style="color:#a31515;">&#8220;BNG&#8221;</span>)),<span style="color:#0000ff;">new</span> <span style="color:#2b91af;">XElement</span>(<span style="color:#a31515;">&#8220;Home&#8221;</span>,<span style="color:#0000ff;">new</span> <span style="color:#2b91af;">XElement</span>(<span style="color:#a31515;">&#8220;Add1&#8243;</span>,<span style="color:#a31515;">&#8220;pppp&#8221;</span>),<span style="color:#0000ff;">new</span> <span style="color:#2b91af;">XElement</span>(<span style="color:#a31515;">&#8220;City&#8221;</span>,<span style="color:#a31515;">&#8220;BNG&#8221;</span>))));</li>
<li style="background:#f3f3f3;"> </li>
<li> </li>
<li style="background:#f3f3f3;">             <span style="color:#2b91af;">Console</span>.WriteLine(con.ToString());</li>
<li> </li>
<li style="background:#f3f3f3;"> </li>
<li>             <span style="color:#0000ff;">var</span> cons = con.DescendantsAndSelf(<span style="color:#a31515;">&#8220;Contact&#8221;</span>);</li>
<li style="background:#f3f3f3;"> </li>
<li>             <span style="color:#0000ff;">var</span> con_one = <span style="color:#0000ff;">from</span> c <span style="color:#0000ff;">in</span> cons</li>
<li style="background:#f3f3f3;">                           <span style="color:#0000ff;">where</span> c.Element(<span style="color:#a31515;">&#8220;Office&#8221;</span>).Element(<span style="color:#a31515;">&#8220;City&#8221;</span>).Value == <span style="color:#a31515;">&#8220;Ahd&#8221;</span></li>
<li>                           <span style="color:#0000ff;">let</span> address1 = c.Element(<span style="color:#a31515;">&#8220;Office&#8221;</span>).Element(<span style="color:#a31515;">&#8220;Add1&#8243;</span>)</li>
<li style="background:#f3f3f3;">                           <span style="color:#0000ff;">let</span> city = c.Element(<span style="color:#a31515;">&#8220;Office&#8221;</span>).Element(<span style="color:#a31515;">&#8220;City&#8221;</span>)</li>
<li>                           <span style="color:#0000ff;">select</span> <span style="color:#0000ff;">new</span></li>
<li style="background:#f3f3f3;">                           {</li>
<li>                               AddressForOffice = address1.Value.ToUpper(),</li>
<li style="background:#f3f3f3;">                               CityForOffice = city.Value.ToUpper()</li>
<li>                               </li>
<li style="background:#f3f3f3;">                           };</li>
<li>             <span style="color:#2b91af;">Console</span>.WriteLine(con_one.ToString());</li>
</ol>
</div>
</div>
</div>
<p>If you observed above code, after creating the xml, I have used DescendentaAndSelf method of XElement to create the List of Contact. LINQ will work with collection only so I have to convert XElement into List&lt;XElement&gt;.</p>
<p>&#160;</p>
<p>I have used ‘let’ keyword in between the query. ‘let’ keyword will create the local variable and store the information for the query. </p>
<p>If you observed, I have taken the variable address1 and city and store the value of element which office’s city is “Ahd”.</p>
<p>I have used both the variable when query is creating the output using select new command. </p>
<p><font color="#0080ff">select new      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; AddressForOffice = address1.Value.ToUpper(),       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; CityForOffice = city.Value.ToUpper()       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; };</font></p>
<p>So this way we can store the value in between of linq query and after that we can apply some function (here ToUPPER()) and create the new object.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/miteshisheth.wordpress.com/191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/miteshisheth.wordpress.com/191/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/miteshisheth.wordpress.com/191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/miteshisheth.wordpress.com/191/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/miteshisheth.wordpress.com/191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/miteshisheth.wordpress.com/191/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/miteshisheth.wordpress.com/191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/miteshisheth.wordpress.com/191/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/miteshisheth.wordpress.com/191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/miteshisheth.wordpress.com/191/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/miteshisheth.wordpress.com/191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/miteshisheth.wordpress.com/191/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/miteshisheth.wordpress.com/191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/miteshisheth.wordpress.com/191/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=miteshisheth.wordpress.com&amp;blog=8485788&amp;post=191&amp;subd=miteshisheth&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://miteshisheth.wordpress.com/2010/01/22/linq-to-xml/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bf7c284e28c7cddce77364c96cbb203c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">miteshisheth</media:title>
		</media:content>
	</item>
		<item>
		<title>MessageInspector &#8211; WCF</title>
		<link>http://miteshisheth.wordpress.com/2009/12/15/messageinspector-wcf/</link>
		<comments>http://miteshisheth.wordpress.com/2009/12/15/messageinspector-wcf/#comments</comments>
		<pubDate>Tue, 15 Dec 2009 15:35:47 +0000</pubDate>
		<dc:creator>miteshisheth</dc:creator>
				<category><![CDATA[WCF]]></category>

		<guid isPermaLink="false">http://miteshisheth.wordpress.com/2009/12/15/messageinspector-wcf/</guid>
		<description><![CDATA[Actually I got one assignment from current job that when client call the service, I want to add some object that I can use at service side. &#160; So basically, I want to try to display the SOAP message sent to the service host. In order to do this, you might want to pay attention [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=miteshisheth.wordpress.com&amp;blog=8485788&amp;post=189&amp;subd=miteshisheth&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Actually I got one assignment from current job that when client call the service, I want to add some object that I can use at service side.</p>
<p>&#160;</p>
<p>So basically, I want to try to display the SOAP message sent to the service host. In order to do this, you might want to pay attention to 3 things: </p>
<p>· System.ServiceModel.Configuration.BehaviorExtensionElement</p>
<p>· System.ServiceModel.Description.IEndpointBehavior</p>
<p>· System.ServiceModel.Dispatcher.IClientMessageInspector</p>
<p>&#160;</p>
<p>You can fine code here : <a title="http://cid-39f476822b8257be.skydrive.live.com/self.aspx/.Public/WCF^_Demo/MitWCFDay1.zip" href="http://cid-39f476822b8257be.skydrive.live.com/self.aspx/.Public/WCF^_Demo/MitWCFDay1.zip">http://cid-39f476822b8257be.skydrive.live.com/self.aspx/.Public/WCF^_Demo/MitWCFDay1.zip</a></p>
<p>Here is the service…</p>
<div style="padding:5px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:1b256afb-04ad-4edd-9142-0dc8647780c1" class="wlWriterEditableSmartContent">
<div style="border:#000080 1px solid;font-family:'Courier New', Courier, Monospace;font-size:10pt;">
<div style="background:#000080;color:#fff;font-family:Verdana, Tahoma, Arial, sans-serif;font-weight:bold;padding:2px 5px;">Code Snippet</div>
<div style="background:#ddd;max-height:300px;overflow:auto;padding:0;">
<ol style="background:#ffffff;white-space:wrap;margin:0 0 0 35px;">
<li> <span style="color:#0000ff;">using</span> System;</li>
<li style="background:#f3f3f3;"> <span style="color:#0000ff;">using</span> System.Collections.Generic;</li>
<li> <span style="color:#0000ff;">using</span> System.Linq;</li>
<li style="background:#f3f3f3;"> <span style="color:#0000ff;">using</span> System.Text;</li>
<li> <span style="color:#0000ff;">using</span> System.ServiceModel;</li>
<li style="background:#f3f3f3;"> <span style="color:#0000ff;">using</span> MitWCFDay2;</li>
<li> </li>
<li style="background:#f3f3f3;"> <span style="color:#0000ff;">namespace</span> MitWCFDay1</li>
<li> {</li>
<li style="background:#f3f3f3;">     [<span style="color:#2b91af;">ServiceContract</span>]</li>
<li>     [<span style="color:#2b91af;">MyMessageInspector</span>]</li>
<li style="background:#f3f3f3;">     <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">interface</span> <span style="color:#2b91af;">ICalcMath</span></li>
<li>     {</li>
<li style="background:#f3f3f3;">         [<span style="color:#2b91af;">OperationContract</span>]</li>
<li>         <span style="color:#0000ff;">int</span> AddNumber(<span style="color:#0000ff;">int</span> i, <span style="color:#0000ff;">int</span> j);</li>
<li style="background:#f3f3f3;">     }</li>
<li> </li>
<li style="background:#f3f3f3;">     <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">class</span> <span style="color:#2b91af;">CalcMath</span> : <span style="color:#2b91af;">ICalcMath</span></li>
<li>     {</li>
<li style="background:#f3f3f3;"> </li>
<li> </li>
<li style="background:#f3f3f3;">         <span style="color:#0000ff;">#region</span> ICalcMath Members</li>
<li> </li>
<li style="background:#f3f3f3;">         <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">int</span> AddNumber(<span style="color:#0000ff;">int</span> i, <span style="color:#0000ff;">int</span> j)</li>
<li>         {</li>
<li style="background:#f3f3f3;">             <span style="color:#0000ff;">return</span> i + j;</li>
<li>         }</li>
<li style="background:#f3f3f3;"> </li>
<li>         <span style="color:#0000ff;">#endregion</span></li>
<li style="background:#f3f3f3;">     }</li>
<li> }</li>
</ol>
</div>
</div>
</div>
<p>If you observe carefully then one&#160; MyMessageInspector attribute is define to service. I’ll explain that later.</p>
<p>&#160;</p>
<p>Now We have to create MyMessageInspector class&#160; and code is following…</p>
<div style="padding:5px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:ad2df704-7f4f-4ed2-8fd3-afddb80d5fd7" class="wlWriterEditableSmartContent">
<div style="border:#000080 1px solid;font-family:'Courier New', Courier, Monospace;font-size:10pt;">
<div style="background:#000080;color:#fff;font-family:Verdana, Tahoma, Arial, sans-serif;font-weight:bold;padding:2px 5px;">Code Snippet</div>
<div style="background:#ddd;max-height:300px;overflow:auto;padding:0;">
<ol style="background:#ffffff;white-space:wrap;margin:0 0 0 45px;">
<li> <span style="color:#0000ff;">using</span> System;</li>
<li style="background:#f3f3f3;"> <span style="color:#0000ff;">using</span> System.Collections.Generic;</li>
<li> <span style="color:#0000ff;">using</span> System.Linq;</li>
<li style="background:#f3f3f3;"> <span style="color:#0000ff;">using</span> System.Text;</li>
<li> <span style="color:#0000ff;">using</span> System.ServiceModel.Channels;</li>
<li style="background:#f3f3f3;"> <span style="color:#0000ff;">using</span> System.ServiceModel;</li>
<li> <span style="color:#0000ff;">using</span> System.ServiceModel.Description;</li>
<li style="background:#f3f3f3;"> <span style="color:#0000ff;">using</span> System.ServiceModel.Dispatcher;</li>
<li> <span style="color:#0000ff;">using</span> System.ServiceModel.Configuration;</li>
<li style="background:#f3f3f3;"> </li>
<li> <span style="color:#0000ff;">namespace</span> MitWCFDay1</li>
<li style="background:#f3f3f3;"> {</li>
<li>     <span style="color:#0000ff;">class</span> <span style="color:#2b91af;">MyMessageInspector</span> : <span style="color:#2b91af;">Attribute</span>, <span style="color:#2b91af;">IClientMessageInspector</span>, System.ServiceModel.Description.<span style="color:#2b91af;">IEndpointBehavior</span></li>
<li style="background:#f3f3f3;">     {</li>
<li> </li>
<li style="background:#f3f3f3;">         <span style="color:#0000ff;">#region</span> IClientMessageInspector Members</li>
<li> </li>
<li style="background:#f3f3f3;"> </li>
<li>         <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">void</span> AfterReceiveReply(<span style="color:#0000ff;">ref</span> <span style="color:#2b91af;">Message</span> reply, <span style="color:#0000ff;">object</span> correlationState)</li>
<li style="background:#f3f3f3;">         {   <span style="color:#008000;">// Ignore</span></li>
<li> </li>
<li style="background:#f3f3f3;">         }</li>
<li> </li>
<li style="background:#f3f3f3;"> </li>
<li>         <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">object</span> BeforeSendRequest(<span style="color:#0000ff;">ref</span> <span style="color:#2b91af;">Message</span> request, <span style="color:#2b91af;">IClientChannel</span> channel)</li>
<li style="background:#f3f3f3;">         {</li>
<li> </li>
<li style="background:#f3f3f3;">             <span style="color:#2b91af;">Console</span>.WriteLine(request.ToString());</li>
<li> </li>
<li style="background:#f3f3f3;">            </li>
<li>             <span style="color:#0000ff;">return</span> <span style="color:#0000ff;">null</span>;</li>
<li style="background:#f3f3f3;"> </li>
<li>         }</li>
<li style="background:#f3f3f3;"> </li>
<li> </li>
<li style="background:#f3f3f3;">         <span style="color:#0000ff;">#endregion</span></li>
<li> </li>
<li style="background:#f3f3f3;">         <span style="color:#0000ff;"> #region</span> IEndpointBehavior Members</li>
<li> </li>
<li style="background:#f3f3f3;"> </li>
<li>         <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">void</span> AddBindingParameters(<span style="color:#2b91af;">ServiceEndpoint</span> endpoint, System.ServiceModel.Channels.<span style="color:#2b91af;">BindingParameterCollection</span> bindingParameters)</li>
<li style="background:#f3f3f3;">         { <span style="color:#008000;">// Ignore</span></li>
<li> </li>
<li style="background:#f3f3f3;">         }</li>
<li> </li>
<li style="background:#f3f3f3;"> </li>
<li>         <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">void</span> ApplyClientBehavior(<span style="color:#2b91af;">ServiceEndpoint</span> endpoint, <span style="color:#2b91af;">ClientRuntime</span> clientRuntime)</li>
<li style="background:#f3f3f3;">         {</li>
<li> </li>
<li style="background:#f3f3f3;">             clientRuntime.MessageInspectors.Add(<span style="color:#0000ff;">new</span> <span style="color:#2b91af;">MyMessageInspector</span>());</li>
<li> </li>
<li style="background:#f3f3f3;">         }</li>
<li> </li>
<li style="background:#f3f3f3;"> </li>
<li>         <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">void</span> ApplyDispatchBehavior(<span style="color:#2b91af;">ServiceEndpoint</span> endpoint, <span style="color:#2b91af;">EndpointDispatcher</span> endpointDispatcher)</li>
<li style="background:#f3f3f3;">         { <span style="color:#008000;">// Ignore</span></li>
<li> </li>
<li style="background:#f3f3f3;">         }</li>
<li> </li>
<li style="background:#f3f3f3;"> </li>
<li>         <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">void</span> Validate(<span style="color:#2b91af;">ServiceEndpoint</span> endpoint)</li>
<li style="background:#f3f3f3;">         { <span style="color:#008000;">// Ignore</span></li>
<li> </li>
<li style="background:#f3f3f3;">         }</li>
<li> </li>
<li style="background:#f3f3f3;"> </li>
<li>         <span style="color:#0000ff;">#endregion</span></li>
<li style="background:#f3f3f3;">     }</li>
<li> </li>
<li style="background:#f3f3f3;">     </li>
<li>     </li>
<li style="background:#f3f3f3;"> </li>
<li>     <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">class</span> <span style="color:#2b91af;">CustomBehaviorSection</span> : <span style="color:#2b91af;">BehaviorExtensionElement</span></li>
<li style="background:#f3f3f3;">     {</li>
<li> </li>
<li style="background:#f3f3f3;">         <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">override</span> <span style="color:#2b91af;">Type</span> BehaviorType</li>
<li>         {</li>
<li style="background:#f3f3f3;"> </li>
<li>             <span style="color:#0000ff;">get</span> { <span style="color:#0000ff;">return</span> <span style="color:#0000ff;">typeof</span>(<span style="color:#2b91af;">MyMessageInspector</span>); }</li>
<li style="background:#f3f3f3;"> </li>
<li>         }</li>
<li style="background:#f3f3f3;"> </li>
<li> </li>
<li style="background:#f3f3f3;">         <span style="color:#0000ff;">protected</span> <span style="color:#0000ff;">override</span> <span style="color:#0000ff;">object</span> CreateBehavior()</li>
<li>         {</li>
<li style="background:#f3f3f3;"> </li>
<li>             <span style="color:#0000ff;">return</span> <span style="color:#0000ff;">new</span> <span style="color:#2b91af;">MyMessageInspector</span>();</li>
<li style="background:#f3f3f3;"> </li>
<li>         }</li>
<li style="background:#f3f3f3;"> </li>
<li>         </li>
<li style="background:#f3f3f3;"> </li>
<li>         </li>
<li style="background:#f3f3f3;">     }</li>
<li> </li>
<li style="background:#f3f3f3;"> </li>
<li>     <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">class</span> <span style="color:#2b91af;">Information</span></li>
<li style="background:#f3f3f3;">     {</li>
<li>         <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">static</span> <span style="color:#2b91af;">Information</span> CurrentInformation { <span style="color:#0000ff;">get</span>; <span style="color:#0000ff;">set</span>; }</li>
<li style="background:#f3f3f3;"> </li>
<li>         <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">string</span> ComputerName { <span style="color:#0000ff;">get</span>; <span style="color:#0000ff;">set</span>; }</li>
<li style="background:#f3f3f3;">         <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">string</span> UserName { <span style="color:#0000ff;">get</span>; <span style="color:#0000ff;">set</span>; }</li>
<li> </li>
<li style="background:#f3f3f3;">         <span style="color:#0000ff;">public</span> Information(<span style="color:#0000ff;">string</span> computerName,<span style="color:#0000ff;">string</span> userName)</li>
<li>         {</li>
<li style="background:#f3f3f3;">             <span style="color:#0000ff;">if</span> (CurrentInformation == <span style="color:#0000ff;">null</span>)</li>
<li>             {</li>
<li style="background:#f3f3f3;">                 <span style="color:#0000ff;">this</span>.ComputerName = computerName;</li>
<li>                 <span style="color:#0000ff;">this</span>.UserName = userName;</li>
<li style="background:#f3f3f3;">                 CurrentInformation = <span style="color:#0000ff;">this</span>;</li>
<li> </li>
<li style="background:#f3f3f3;">             }</li>
<li>             <span style="color:#0000ff;">else</span></li>
<li style="background:#f3f3f3;">                 CurrentInformation = <span style="color:#0000ff;">this</span>;</li>
<li>             </li>
<li style="background:#f3f3f3;"> </li>
<li>         }</li>
<li style="background:#f3f3f3;"> </li>
<li>     }</li>
<li style="background:#f3f3f3;"> </li>
<li> </li>
<li style="background:#f3f3f3;"> </li>
<li> </li>
<li style="background:#f3f3f3;"> }</li>
<li> </li>
</ol>
</div>
</div>
</div>
<p>Here MessageInspector class is responsible to set whatever client want to set.&#160; There is other class call CustomBehaviorSection and it is derived from BehaviorExtensionElement. We have to give this BehaviorExtensionElement into app.config file.</p>
<div style="padding:5px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:e9202415-f70a-4e2c-852d-9f6a55d9a034" class="wlWriterEditableSmartContent">
<div style="border:#000080 1px solid;font-family:'Courier New', Courier, Monospace;font-size:10pt;">
<div style="background:#000080;color:#fff;font-family:Verdana, Tahoma, Arial, sans-serif;font-weight:bold;padding:2px 5px;">Code Snippet</div>
<div style="background:#ddd;max-height:300px;overflow:auto;padding:0;">
<ol style="background:#ffffff;white-space:wrap;margin:0 0 0 35px;">
<li> <span style="color:#0000ff;">&lt;?</span><span style="color:#a31515;">xml</span><span style="color:#0000ff;"> </span><span style="color:#ff0000;">version</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">1.0</span>&#8220;<span style="color:#0000ff;"> </span><span style="color:#ff0000;">encoding</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">utf-8</span>&#8220;<span style="color:#0000ff;"> ?&gt;</span></li>
<li style="background:#f3f3f3;"> <span style="color:#0000ff;">&lt;</span><span style="color:#a31515;">configuration</span><span style="color:#0000ff;">&gt;</span></li>
<li>   <span style="color:#0000ff;"></span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">&lt;</span><span style="color:#a31515;">system.serviceModel</span><span style="color:#0000ff;">&gt;</span></li>
<li>   <span style="color:#0000ff;">  &lt;</span><span style="color:#a31515;">services</span><span style="color:#0000ff;">&gt;</span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">    &lt;</span><span style="color:#a31515;">service</span><span style="color:#0000ff;"> </span><span style="color:#ff0000;">name</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">MitWCFDay1.CalcMath</span>&#8220;<span style="color:#0000ff;"> </span><span style="color:#ff0000;">behaviorConfiguration</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">ForAuthorazation</span>&#8220;<span style="color:#0000ff;">&gt;</span></li>
<li>   <span style="color:#0000ff;">      &lt;</span><span style="color:#a31515;">endpoint</span><span style="color:#0000ff;"> </span><span style="color:#ff0000;">address</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">net.tcp://localhost:56/MyMathService</span>&#8220;<span style="color:#0000ff;"> </span><span style="color:#ff0000;">binding</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">netTcpBinding</span>&#8220;<span style="color:#0000ff;"> </span><span style="color:#ff0000;">contract</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">MitWCFDay1.ICalcMath</span>&#8220;<span style="color:#0000ff;"> </span><span style="color:#ff0000;">bindingConfiguration</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">ForSecurity</span>&#8220;<span style="color:#0000ff;"> </span><span style="color:#ff0000;">name</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">Binding1</span>&#8220;<span style="color:#0000ff;"> /&gt;</span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">      &lt;</span><span style="color:#a31515;">endpoint</span><span style="color:#0000ff;"> </span><span style="color:#ff0000;">address</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">http://localhost:560/MyMathService</span>&#8220;<span style="color:#0000ff;"> </span><span style="color:#ff0000;">binding</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">basicHttpBinding</span>&#8220;<span style="color:#0000ff;"> </span><span style="color:#ff0000;">contract</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">MitWCFDay1.ICalcMath</span>&#8220;<span style="color:#0000ff;"> </span><span style="color:#ff0000;">name</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">Binding2</span>&#8220;  <span style="color:#0000ff;">/&gt;</span></li>
<li>   <span style="color:#0000ff;">      &lt;</span><span style="color:#a31515;">host</span><span style="color:#0000ff;">&gt;</span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">        &lt;</span><span style="color:#a31515;">baseAddresses</span><span style="color:#0000ff;">&gt;</span></li>
<li>   <span style="color:#0000ff;">          &lt;</span><span style="color:#a31515;">add</span><span style="color:#0000ff;"> </span><span style="color:#ff0000;">baseAddress</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">net.tcp://localhost:56/MyMathService</span>&#8220;<span style="color:#0000ff;">/&gt;</span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">        &lt;/</span><span style="color:#a31515;">baseAddresses</span><span style="color:#0000ff;">&gt;</span></li>
<li>   <span style="color:#0000ff;">      &lt;/</span><span style="color:#a31515;">host</span><span style="color:#0000ff;">&gt;</span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">      </span></li>
<li>   <span style="color:#0000ff;">    &lt;/</span><span style="color:#a31515;">service</span><span style="color:#0000ff;">&gt;</span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">    </span></li>
<li>   <span style="color:#0000ff;">    </span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">  &lt;/</span><span style="color:#a31515;">services</span><span style="color:#0000ff;">&gt;</span></li>
<li> </li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">  &lt;</span><span style="color:#a31515;">client</span><span style="color:#0000ff;">&gt;</span></li>
<li>   <span style="color:#0000ff;">    &lt;</span><span style="color:#a31515;">endpoint</span><span style="color:#0000ff;"> </span><span style="color:#ff0000;">address</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">net.tcp://localhost:56/MyMathService</span>&#8220;<span style="color:#0000ff;"> </span><span style="color:#ff0000;">binding</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">netTcpBinding</span>&#8220;<span style="color:#0000ff;"> </span><span style="color:#ff0000;">contract</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">MitWCFDay1.ICalcMath</span>&#8220;<span style="color:#0000ff;"> </span><span style="color:#ff0000;">name</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">Binding1</span>&#8220;<span style="color:#0000ff;"> </span><span style="color:#ff0000;">behaviorConfiguration</span><span style="color:#0000ff;"> =</span>&#8220;<span style="color:#0000ff;">aa</span>&#8220;<span style="color:#0000ff;"> /&gt;</span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">    &lt;</span><span style="color:#a31515;">endpoint</span><span style="color:#0000ff;"> </span><span style="color:#ff0000;">address</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">http://localhost:560/MyMathService</span>&#8220;<span style="color:#0000ff;"> </span><span style="color:#ff0000;">binding</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">basicHttpBinding</span>&#8220;<span style="color:#0000ff;"> </span><span style="color:#ff0000;">contract</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">MitWCFDay1.ICalcMath</span>&#8220;<span style="color:#0000ff;"> </span><span style="color:#ff0000;">name</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">Binding2</span>&#8220;<span style="color:#0000ff;"> </span><span style="color:#ff0000;">behaviorConfiguration</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">aa</span>&#8220;<span style="color:#0000ff;"> /&gt;</span></li>
<li>   <span style="color:#0000ff;">  &lt;/</span><span style="color:#a31515;">client</span><span style="color:#0000ff;">&gt;</span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">  &lt;</span><span style="color:#a31515;">behaviors</span><span style="color:#0000ff;">&gt;</span></li>
<li>   <span style="color:#0000ff;">    </span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">    &lt;</span><span style="color:#a31515;">serviceBehaviors</span><span style="color:#0000ff;">&gt;</span></li>
<li>   <span style="color:#0000ff;">      &lt;</span><span style="color:#a31515;">behavior</span>  <span style="color:#0000ff;"></span><span style="color:#ff0000;">name</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">ForAuthorazation</span>&#8220;<span style="color:#0000ff;">&gt;</span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">        &lt;</span><span style="color:#a31515;">serviceAuthorization</span><span style="color:#0000ff;"> </span><span style="color:#ff0000;">serviceAuthorizationManagerType</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">MitWCFDay1.CalcAutoMng,MitWCFDay1</span>&#8220;<span style="color:#0000ff;"> /&gt;</span></li>
<li>   <span style="color:#0000ff;">      </span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">      &lt;/</span><span style="color:#a31515;">behavior</span><span style="color:#0000ff;">&gt;</span></li>
<li>   <span style="color:#0000ff;">    &lt;/</span><span style="color:#a31515;">serviceBehaviors</span><span style="color:#0000ff;">&gt;</span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">    &lt;</span><span style="color:#a31515;">endpointBehaviors</span><span style="color:#0000ff;"> &gt;</span></li>
<li>   <span style="color:#0000ff;">      &lt;</span><span style="color:#a31515;">behavior</span><span style="color:#0000ff;"> </span><span style="color:#ff0000;">name</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">aa</span>&#8220;<span style="color:#0000ff;">&gt;</span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">        &lt;</span><span style="color:#a31515;">CustomBehaviorSection</span><span style="color:#0000ff;"> /&gt;</span></li>
<li>   <span style="color:#0000ff;">      &lt;/</span><span style="color:#a31515;">behavior</span><span style="color:#0000ff;">&gt;</span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">    &lt;/</span><span style="color:#a31515;">endpointBehaviors</span><span style="color:#0000ff;">&gt;</span></li>
<li>   <span style="color:#0000ff;">  &lt;/</span><span style="color:#a31515;">behaviors</span><span style="color:#0000ff;">&gt;</span></li>
<li style="background:#f3f3f3;"> </li>
<li>   <span style="color:#0000ff;">  &lt;</span><span style="color:#a31515;">extensions</span><span style="color:#0000ff;">&gt;</span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">    &lt;</span><span style="color:#a31515;">behaviorExtensions</span><span style="color:#0000ff;">&gt;</span></li>
<li>   <span style="color:#0000ff;">      &lt;</span><span style="color:#a31515;">add</span><span style="color:#0000ff;"> </span><span style="color:#ff0000;">name</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">CustomBehaviorSection</span>&#8220;<span style="color:#0000ff;"> </span><span style="color:#ff0000;">type</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">MitWCFDay1.CustomBehaviorSection, MitWCFDay1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</span>&#8220;  <span style="color:#0000ff;">/&gt;</span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">    &lt;/</span><span style="color:#a31515;">behaviorExtensions</span><span style="color:#0000ff;">&gt;</span></li>
<li>   <span style="color:#0000ff;">  &lt;/</span><span style="color:#a31515;">extensions</span><span style="color:#0000ff;">&gt;</span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">  </span></li>
<li>   <span style="color:#0000ff;">  </span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">  </span></li>
<li>   <span style="color:#0000ff;">  &lt;</span><span style="color:#a31515;">bindings</span><span style="color:#0000ff;">&gt;</span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">    &lt;</span><span style="color:#a31515;">netTcpBinding</span><span style="color:#0000ff;">&gt;</span></li>
<li>   <span style="color:#0000ff;">      &lt;</span><span style="color:#a31515;">binding</span><span style="color:#0000ff;"> </span><span style="color:#ff0000;">name</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">ForSecurity</span>&#8220;<span style="color:#0000ff;">&gt;</span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">        &lt;</span><span style="color:#a31515;">security</span><span style="color:#0000ff;"> </span><span style="color:#ff0000;">mode</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">Transport</span>&#8220;<span style="color:#0000ff;">&gt;</span></li>
<li>   <span style="color:#0000ff;">          </span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">          &lt;</span><span style="color:#a31515;">transport</span><span style="color:#0000ff;"> </span><span style="color:#ff0000;">clientCredentialType</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">Windows</span>&#8220;<span style="color:#0000ff;">/&gt;</span></li>
<li>   <span style="color:#0000ff;">          </span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">        &lt;/</span><span style="color:#a31515;">security</span><span style="color:#0000ff;">&gt;</span></li>
<li>   <span style="color:#0000ff;">      &lt;/</span><span style="color:#a31515;">binding</span><span style="color:#0000ff;">&gt;</span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">      </span></li>
<li>   <span style="color:#0000ff;">    &lt;/</span><span style="color:#a31515;">netTcpBinding</span><span style="color:#0000ff;">&gt;</span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">    </span></li>
<li>   <span style="color:#0000ff;">  &lt;/</span><span style="color:#a31515;">bindings</span><span style="color:#0000ff;">&gt;</span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">  </span></li>
<li>   <span style="color:#0000ff;">  </span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">&lt;/</span><span style="color:#a31515;">system.serviceModel</span><span style="color:#0000ff;">&gt;</span></li>
<li> <span style="color:#0000ff;">&lt;/</span><span style="color:#a31515;">configuration</span><span style="color:#0000ff;">&gt;</span></li>
</ol>
</div>
</div>
</div>
<p>First we have created behaviorExtensions and after we have define that into endpointBehaviors.</p>
<p>now if you put break point on MessageInspector , before calling the service it will call the methods of MessageInspector&#160; class. </p>
<p>Don’t forget to add the attribute on service.. other wise throw the error…</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/miteshisheth.wordpress.com/189/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/miteshisheth.wordpress.com/189/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/miteshisheth.wordpress.com/189/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/miteshisheth.wordpress.com/189/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/miteshisheth.wordpress.com/189/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/miteshisheth.wordpress.com/189/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/miteshisheth.wordpress.com/189/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/miteshisheth.wordpress.com/189/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/miteshisheth.wordpress.com/189/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/miteshisheth.wordpress.com/189/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/miteshisheth.wordpress.com/189/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/miteshisheth.wordpress.com/189/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/miteshisheth.wordpress.com/189/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/miteshisheth.wordpress.com/189/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=miteshisheth.wordpress.com&amp;blog=8485788&amp;post=189&amp;subd=miteshisheth&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://miteshisheth.wordpress.com/2009/12/15/messageinspector-wcf/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bf7c284e28c7cddce77364c96cbb203c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">miteshisheth</media:title>
		</media:content>
	</item>
		<item>
		<title>How to host service as a Windows Services</title>
		<link>http://miteshisheth.wordpress.com/2009/12/14/how-to-host-service-as-a-windows-services/</link>
		<comments>http://miteshisheth.wordpress.com/2009/12/14/how-to-host-service-as-a-windows-services/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 12:15:27 +0000</pubDate>
		<dc:creator>miteshisheth</dc:creator>
				<category><![CDATA[WCF]]></category>

		<guid isPermaLink="false">http://miteshisheth.wordpress.com/2009/12/14/how-to-host-service-as-a-windows-services/</guid>
		<description><![CDATA[We can host services three ways… 1. Self Host 2. IIS 3. Window Service &#160; This article is for Hosing service as a Windows Services. I have following services.. Code Snippet using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.ServiceModel; namespace CalcService {    [ServiceContract]     public interface ICalc     {        [OperationContract]        int GetSum(int i, int j); [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=miteshisheth.wordpress.com&amp;blog=8485788&amp;post=188&amp;subd=miteshisheth&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>We can host services three ways…</p>
<p>1. Self Host</p>
<p>2. IIS</p>
<p>3. Window Service</p>
<p>&#160;</p>
<p>This article is for Hosing service as a Windows Services.</p>
<p>I have following services..</p>
<div style="padding:5px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:46b65951-8f1d-4127-b126-bae8e76d8a26" class="wlWriterEditableSmartContent">
<div style="border:#000080 1px solid;font-family:'Courier New', Courier, Monospace;font-size:10pt;">
<div style="background:#000080;color:#fff;font-family:Verdana, Tahoma, Arial, sans-serif;font-weight:bold;padding:2px 5px;">Code Snippet</div>
<div style="background:#ddd;max-height:300px;overflow:auto;padding:0;">
<ol style="background:#ffffff;white-space:wrap;margin:0 0 0 35px;">
<li> <span style="color:#0000ff;">using</span> System;</li>
<li style="background:#f3f3f3;"> <span style="color:#0000ff;">using</span> System.Collections.Generic;</li>
<li> <span style="color:#0000ff;">using</span> System.Linq;</li>
<li style="background:#f3f3f3;"> <span style="color:#0000ff;">using</span> System.Text;</li>
<li> <span style="color:#0000ff;">using</span> System.ServiceModel;</li>
<li style="background:#f3f3f3;"> </li>
<li> <span style="color:#0000ff;">namespace</span> CalcService</li>
<li style="background:#f3f3f3;"> {</li>
<li>    [<span style="color:#2b91af;">ServiceContract</span>]</li>
<li style="background:#f3f3f3;">     <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">interface</span> <span style="color:#2b91af;">ICalc</span></li>
<li>     {</li>
<li style="background:#f3f3f3;">        [<span style="color:#2b91af;">OperationContract</span>]</li>
<li>        <span style="color:#0000ff;">int</span> GetSum(<span style="color:#0000ff;">int</span> i, <span style="color:#0000ff;">int</span> j);</li>
<li style="background:#f3f3f3;">     }</li>
<li> </li>
<li style="background:#f3f3f3;"> </li>
<li>    <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">class</span> <span style="color:#2b91af;">CalcServices</span> : <span style="color:#2b91af;">ICalc</span></li>
<li style="background:#f3f3f3;">    {</li>
<li> </li>
<li style="background:#f3f3f3;">        <span style="color:#0000ff;">#region</span> ICalc Members</li>
<li> </li>
<li style="background:#f3f3f3;">        <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">int</span> GetSum(<span style="color:#0000ff;">int</span> i, <span style="color:#0000ff;">int</span> j)</li>
<li>        {</li>
<li style="background:#f3f3f3;">            <span style="color:#0000ff;">return</span> i + j;</li>
<li>        }</li>
<li style="background:#f3f3f3;"> </li>
<li>        <span style="color:#0000ff;">#endregion</span></li>
<li style="background:#f3f3f3;">    }</li>
<li> }</li>
</ol>
</div>
</div>
</div>
<p>&#160;</p>
<p>Following is the App.config.</p>
<p>&#160;</p>
<div style="padding:5px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:39d31361-b4f7-4f4e-a493-b9e045f81932" class="wlWriterEditableSmartContent">
<div style="border:#000080 1px solid;font-family:'Courier New', Courier, Monospace;font-size:10pt;">
<div style="background:#000080;color:#fff;font-family:Verdana, Tahoma, Arial, sans-serif;font-weight:bold;padding:2px 5px;">Code Snippet</div>
<div style="background:#ddd;max-height:300px;overflow:auto;padding:0;">
<ol style="background:#ffffff;white-space:wrap;margin:0 0 0 35px;">
<li> <span style="color:#0000ff;">&lt;?</span><span style="color:#a31515;">xml</span><span style="color:#0000ff;"> </span><span style="color:#ff0000;">version</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">1.0</span>&#8220;<span style="color:#0000ff;"> </span><span style="color:#ff0000;">encoding</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">utf-8</span>&#8220;<span style="color:#0000ff;"> ?&gt;</span></li>
<li style="background:#f3f3f3;"> <span style="color:#0000ff;">&lt;</span><span style="color:#a31515;">configuration</span><span style="color:#0000ff;">&gt;</span></li>
<li>   <span style="color:#0000ff;">&lt;</span><span style="color:#a31515;">system.serviceModel</span><span style="color:#0000ff;">&gt;</span></li>
<li style="background:#f3f3f3;"> </li>
<li>   <span style="color:#0000ff;">  &lt;</span><span style="color:#a31515;">services</span><span style="color:#0000ff;">&gt;</span></li>
<li style="background:#f3f3f3;"> </li>
<li>   <span style="color:#0000ff;">    &lt;</span><span style="color:#a31515;">service</span><span style="color:#0000ff;"> </span><span style="color:#ff0000;">name</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">CalcService.CalcServices</span>&#8220;<span style="color:#0000ff;">&gt;</span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">      &lt;</span><span style="color:#a31515;">endpoint</span><span style="color:#0000ff;"> </span><span style="color:#ff0000;">address</span><span style="color:#0000ff;">=</span>&#8220;&#8221;<span style="color:#0000ff;"> </span><span style="color:#ff0000;">binding</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">basicHttpBinding</span>&#8220;<span style="color:#0000ff;"> </span><span style="color:#ff0000;">contract</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">CalcService.ICalc</span>&#8220;<span style="color:#0000ff;">/&gt;</span></li>
<li>   <span style="color:#0000ff;">      &lt;</span><span style="color:#a31515;">host</span><span style="color:#0000ff;">&gt;</span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">        &lt;</span><span style="color:#a31515;">baseAddresses</span><span style="color:#0000ff;">&gt;</span></li>
<li>   <span style="color:#0000ff;">          &lt;</span><span style="color:#a31515;">add</span><span style="color:#0000ff;"> </span><span style="color:#ff0000;">baseAddress</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">http://localhost:1234/CalcServices</span>&#8220;<span style="color:#0000ff;">/&gt;</span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">        &lt;/</span><span style="color:#a31515;">baseAddresses</span><span style="color:#0000ff;">&gt;</span></li>
<li>   <span style="color:#0000ff;">      &lt;/</span><span style="color:#a31515;">host</span><span style="color:#0000ff;">&gt;</span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">      </span></li>
<li>   <span style="color:#0000ff;">      </span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">    &lt;/</span><span style="color:#a31515;">service</span><span style="color:#0000ff;">&gt;</span></li>
<li>   <span style="color:#0000ff;">    </span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">  &lt;/</span><span style="color:#a31515;">services</span><span style="color:#0000ff;">&gt;</span></li>
<li>   <span style="color:#0000ff;">  </span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">  </span></li>
<li>   <span style="color:#0000ff;">  </span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">&lt;/</span><span style="color:#a31515;">system.serviceModel</span><span style="color:#0000ff;">&gt;  </span></li>
<li> </li>
<li style="background:#f3f3f3;"> </li>
<li> <span style="color:#0000ff;">&lt;/</span><span style="color:#a31515;">configuration</span><span style="color:#0000ff;">&gt;</span></li>
</ol>
</div>
</div>
</div>
<p>Now Add two files in the solution.</p>
<p>1. Windows Service and</p>
<p>2. Installer Class</p>
<p>Write down following code into Service1 (Windows Service class) class..</p>
<div style="padding:5px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:26fe1aa4-06d5-4b5f-b142-bf57a3b56c5b" class="wlWriterEditableSmartContent">
<div style="border:#000080 1px solid;font-family:'Courier New', Courier, Monospace;font-size:10pt;">
<div style="background:#000080;color:#fff;font-family:Verdana, Tahoma, Arial, sans-serif;font-weight:bold;padding:2px 5px;">Code Snippet</div>
<div style="background:#ddd;max-height:300px;overflow:auto;padding:0;">
<ol style="background:#ffffff;white-space:wrap;margin:0 0 0 35px;">
<li> <span style="color:#0000ff;">using</span> System;</li>
<li style="background:#f3f3f3;"> <span style="color:#0000ff;">using</span> System.Collections.Generic;</li>
<li> <span style="color:#0000ff;">using</span> System.ComponentModel;</li>
<li style="background:#f3f3f3;"> <span style="color:#0000ff;">using</span> System.Data;</li>
<li> <span style="color:#0000ff;">using</span> System.Diagnostics;</li>
<li style="background:#f3f3f3;"> <span style="color:#0000ff;">using</span> System.Linq;</li>
<li> <span style="color:#0000ff;">using</span> System.ServiceProcess;</li>
<li style="background:#f3f3f3;"> <span style="color:#0000ff;">using</span> System.Text;</li>
<li> <span style="color:#0000ff;">using</span> System.ServiceModel;</li>
<li style="background:#f3f3f3;"> </li>
<li> <span style="color:#0000ff;">namespace</span> CalcService</li>
<li style="background:#f3f3f3;"> {</li>
<li>     <span style="color:#0000ff;">partial</span> <span style="color:#0000ff;">class</span> <span style="color:#2b91af;">Service1</span> : <span style="color:#2b91af;">ServiceBase</span></li>
<li style="background:#f3f3f3;">     {</li>
<li>         <span style="color:#0000ff;">public</span> Service1()</li>
<li style="background:#f3f3f3;">         {</li>
<li>             InitializeComponent();</li>
<li style="background:#f3f3f3;">         }</li>
<li>         <span style="color:#2b91af;">ServiceHost</span> sn;</li>
<li style="background:#f3f3f3;">         <span style="color:#0000ff;">protected</span> <span style="color:#0000ff;">override</span> <span style="color:#0000ff;">void</span> OnStart(<span style="color:#0000ff;">string</span>[] args)</li>
<li>         {</li>
<li style="background:#f3f3f3;">             sn = <span style="color:#0000ff;">new</span> <span style="color:#2b91af;">ServiceHost</span>(<span style="color:#0000ff;">typeof</span>(CalcService.<span style="color:#2b91af;">CalcServices</span>), <span style="color:#0000ff;">new</span> <span style="color:#2b91af;">Uri</span>[] { });</li>
<li>             sn.Open();</li>
<li style="background:#f3f3f3;">         }</li>
<li> </li>
<li style="background:#f3f3f3;">         <span style="color:#0000ff;">protected</span> <span style="color:#0000ff;">override</span> <span style="color:#0000ff;">void</span> OnStop()</li>
<li>         {</li>
<li style="background:#f3f3f3;">             sn.Close();</li>
<li>         }</li>
<li style="background:#f3f3f3;">     }</li>
<li> }</li>
</ol>
</div>
</div>
</div>
<p>Write down following code into Installer1</p>
<div style="padding:5px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:515fac41-cf31-4349-ad10-6f123972becb" class="wlWriterEditableSmartContent">
<div style="border:#000080 1px solid;font-family:'Courier New', Courier, Monospace;font-size:10pt;">
<div style="background:#000080;color:#fff;font-family:Verdana, Tahoma, Arial, sans-serif;font-weight:bold;padding:2px 5px;">Code Snippet</div>
<div style="background:#ddd;max-height:300px;overflow:auto;padding:0;">
<ol style="background:#ffffff;white-space:wrap;margin:0 0 0 35px;">
<li> <span style="color:#0000ff;">using</span> System;</li>
<li style="background:#f3f3f3;"> <span style="color:#0000ff;">using</span> System.Collections;</li>
<li> <span style="color:#0000ff;">using</span> System.Collections.Generic;</li>
<li style="background:#f3f3f3;"> <span style="color:#0000ff;">using</span> System.ComponentModel;</li>
<li> <span style="color:#0000ff;">using</span> System.Configuration.Install;</li>
<li style="background:#f3f3f3;"> <span style="color:#0000ff;">using</span> System.Linq;</li>
<li> <span style="color:#0000ff;">using</span> System.ServiceProcess;</li>
<li style="background:#f3f3f3;"> </li>
<li> </li>
<li style="background:#f3f3f3;"> <span style="color:#0000ff;">namespace</span> CalcService</li>
<li> {</li>
<li style="background:#f3f3f3;">     [<span style="color:#2b91af;">RunInstaller</span>(<span style="color:#0000ff;">true</span>)]</li>
<li>     <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">partial</span> <span style="color:#0000ff;">class</span> <span style="color:#2b91af;">Installer1</span> : <span style="color:#2b91af;">Installer</span></li>
<li style="background:#f3f3f3;">     {</li>
<li>         <span style="color:#0000ff;">public</span> Installer1()</li>
<li style="background:#f3f3f3;">         {</li>
<li>             InitializeComponent();</li>
<li style="background:#f3f3f3;"> </li>
<li> </li>
<li style="background:#f3f3f3;">             <span style="color:#2b91af;">ServiceProcessInstaller</span> processInstaller = <span style="color:#0000ff;">new</span> <span style="color:#2b91af;">ServiceProcessInstaller</span>();</li>
<li>             <span style="color:#2b91af;">ServiceInstaller</span> serviceInstaller = <span style="color:#0000ff;">new</span> <span style="color:#2b91af;">ServiceInstaller</span>();</li>
<li style="background:#f3f3f3;"> </li>
<li>             processInstaller.Account = <span style="color:#2b91af;">ServiceAccount</span>.LocalSystem;</li>
<li style="background:#f3f3f3;"> </li>
<li>             serviceInstaller.DisplayName = <span style="color:#a31515;">&#8220;Service1&#8243;</span>;</li>
<li style="background:#f3f3f3;">             serviceInstaller.Description = <span style="color:#a31515;">&#8220;CalcService.&#8221;</span>;</li>
<li>             serviceInstaller.ServiceName = <span style="color:#a31515;">&#8220;Service1&#8243;</span>;</li>
<li style="background:#f3f3f3;">             serviceInstaller.StartType = <span style="color:#2b91af;">ServiceStartMode</span>.Manual;</li>
<li> </li>
<li style="background:#f3f3f3;">             Installers.Add(processInstaller);</li>
<li>             Installers.Add(serviceInstaller);</li>
<li style="background:#f3f3f3;"> </li>
<li>         }</li>
<li style="background:#f3f3f3;">     }</li>
<li> }</li>
<li style="background:#f3f3f3;"> </li>
</ol>
</div>
</div>
</div>
<p>Now we have written both the service and Installer. Now we have to write code for start up means some ware I’ve to call ..</p>
<p>I’ve written in main program</p>
<p>&#160;</p>
<div style="padding:5px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:67730177-30d8-44e6-b69e-7a59809d2ee4" class="wlWriterEditableSmartContent">
<div style="border:#000080 1px solid;font-family:'Courier New', Courier, Monospace;font-size:10pt;">
<div style="background:#000080;color:#fff;font-family:Verdana, Tahoma, Arial, sans-serif;font-weight:bold;padding:2px 5px;">Code Snippet</div>
<div style="background:#ddd;max-height:300px;overflow:auto;padding:0;">
<ol style="background:#ffffff;white-space:wrap;margin:0 0 0 35px;">
<li> <span style="color:#0000ff;">using</span> System;</li>
<li style="background:#f3f3f3;"> <span style="color:#0000ff;">using</span> System.Collections.Generic;</li>
<li> <span style="color:#0000ff;">using</span> System.Linq;</li>
<li style="background:#f3f3f3;"> <span style="color:#0000ff;">using</span> System.Text;</li>
<li> <span style="color:#0000ff;">using</span> System.ServiceProcess;</li>
<li style="background:#f3f3f3;"> </li>
<li> <span style="color:#0000ff;">namespace</span> CalcService</li>
<li style="background:#f3f3f3;"> {</li>
<li>     <span style="color:#0000ff;">class</span> <span style="color:#2b91af;">Program</span></li>
<li style="background:#f3f3f3;">     {</li>
<li>         <span style="color:#0000ff;">static</span> <span style="color:#0000ff;">void</span> Main(<span style="color:#0000ff;">string</span>[] args)</li>
<li style="background:#f3f3f3;">         {</li>
<li>             <span style="color:#2b91af;">ServiceBase</span>[] ServicesToRun;</li>
<li style="background:#f3f3f3;"> </li>
<li>             ServicesToRun = <span style="color:#0000ff;">new</span> <span style="color:#2b91af;">ServiceBase</span>[] { <span style="color:#0000ff;">new</span> <span style="color:#2b91af;">Service1</span>() };</li>
<li style="background:#f3f3f3;"> </li>
<li>             <span style="color:#2b91af;">ServiceBase</span>.Run(ServicesToRun);</li>
<li style="background:#f3f3f3;"> </li>
<li>         }</li>
<li style="background:#f3f3f3;">     }</li>
<li> }</li>
</ol>
</div>
</div>
</div>
<p>&#160;</p>
<p>Now we have done everything. Final step is after compiling the solution, we have to install through command prompt.</p>
<p>&#160;</p>
<p>c:&gt; Installutil –i c:…..DebugCaleService.exe</p>
<p>&#160;</p>
<p>Now if you check in service.msi, you can get the service.</p>
<p>Hope this is useful …:)</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/miteshisheth.wordpress.com/188/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/miteshisheth.wordpress.com/188/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/miteshisheth.wordpress.com/188/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/miteshisheth.wordpress.com/188/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/miteshisheth.wordpress.com/188/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/miteshisheth.wordpress.com/188/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/miteshisheth.wordpress.com/188/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/miteshisheth.wordpress.com/188/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/miteshisheth.wordpress.com/188/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/miteshisheth.wordpress.com/188/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/miteshisheth.wordpress.com/188/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/miteshisheth.wordpress.com/188/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/miteshisheth.wordpress.com/188/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/miteshisheth.wordpress.com/188/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=miteshisheth.wordpress.com&amp;blog=8485788&amp;post=188&amp;subd=miteshisheth&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://miteshisheth.wordpress.com/2009/12/14/how-to-host-service-as-a-windows-services/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bf7c284e28c7cddce77364c96cbb203c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">miteshisheth</media:title>
		</media:content>
	</item>
		<item>
		<title>WCF &#8211; FactoryChannel</title>
		<link>http://miteshisheth.wordpress.com/2009/12/10/wcf-factorychannel/</link>
		<comments>http://miteshisheth.wordpress.com/2009/12/10/wcf-factorychannel/#comments</comments>
		<pubDate>Thu, 10 Dec 2009 12:04:16 +0000</pubDate>
		<dc:creator>miteshisheth</dc:creator>
				<category><![CDATA[WCF]]></category>

		<guid isPermaLink="false">http://miteshisheth.wordpress.com/2009/12/10/wcf-factorychannel/</guid>
		<description><![CDATA[We can call service by using two way 1. Create a proxy in client place 2. Create ChannelFactory and directly call the service (without Proxy) &#160; I’m going to discuss both in this article. For both the approach , we require the service… Following is the service code. Code Snippet using System; using System.Collections.Generic; using [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=miteshisheth.wordpress.com&amp;blog=8485788&amp;post=185&amp;subd=miteshisheth&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>We can call service by using two way </p>
<p>1. Create a proxy in client place </p>
<p>2. Create ChannelFactory and directly call the service (without Proxy)</p>
<p>&#160;</p>
<p>I’m going to discuss both in this article.</p>
<p>For both the approach , we require the service… Following is the service code.</p>
<div style="padding:5px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:3f52df84-7903-4160-8012-0e2473ce6246" class="wlWriterEditableSmartContent">
<div style="border:#000080 1px solid;font-family:'Courier New', Courier, Monospace;font-size:10pt;">
<div style="background:#000080;color:#fff;font-family:Verdana, Tahoma, Arial, sans-serif;font-weight:bold;padding:2px 5px;">Code Snippet</div>
<div style="background:#ddd;max-height:300px;overflow:auto;padding:0;">
<ol style="background:#ffffff;white-space:wrap;margin:0 0 0 35px;">
<li> <span style="color:#0000ff;">using</span> System;</li>
<li style="background:#f3f3f3;"> <span style="color:#0000ff;">using</span> System.Collections.Generic;</li>
<li> <span style="color:#0000ff;">using</span> System.Linq;</li>
<li style="background:#f3f3f3;"> <span style="color:#0000ff;">using</span> System.Web;</li>
<li> <span style="color:#0000ff;">using</span> System.ServiceModel;</li>
<li style="background:#f3f3f3;"> </li>
<li> <span style="color:#0000ff;">namespace</span> WcfPlay1</li>
<li style="background:#f3f3f3;"> {</li>
<li>     [<span style="color:#2b91af;">ServiceContract</span>]</li>
<li style="background:#f3f3f3;">     <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">interface</span> <span style="color:#2b91af;">ICalcService</span></li>
<li>     {</li>
<li style="background:#f3f3f3;">         [<span style="color:#2b91af;">OperationContract</span>]</li>
<li>         <span style="color:#0000ff;">int</span> Add(<span style="color:#0000ff;">int</span> i, <span style="color:#0000ff;">int</span> j);</li>
<li style="background:#f3f3f3;">     }</li>
<li> </li>
<li style="background:#f3f3f3;">     <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">class</span> <span style="color:#2b91af;">CalcService</span> : <span style="color:#2b91af;">ICalcService</span></li>
<li>     {</li>
<li style="background:#f3f3f3;"> </li>
<li>         <span style="color:#0000ff;">#region</span> ICalcService Members</li>
<li style="background:#f3f3f3;"> </li>
<li>         <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">int</span> Add(<span style="color:#0000ff;">int</span> i, <span style="color:#0000ff;">int</span> j)</li>
<li style="background:#f3f3f3;">         {</li>
<li>             <span style="color:#0000ff;">return</span> i + j;</li>
<li style="background:#f3f3f3;">         }</li>
<li> </li>
<li style="background:#f3f3f3;">         <span style="color:#0000ff;">#endregion</span></li>
<li>     }</li>
<li style="background:#f3f3f3;"> }</li>
</ol>
</div>
</div>
</div>
<p>&#160;</p>
<p>Now we have to host the service. Following is the Config file </p>
<div style="padding:5px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c8cd4171-d94d-486d-b6e6-14a524943ac5" class="wlWriterEditableSmartContent">
<div style="border:#000080 1px solid;font-family:'Courier New', Courier, Monospace;font-size:10pt;">
<div style="background:#000080;color:#fff;font-family:Verdana, Tahoma, Arial, sans-serif;font-weight:bold;padding:2px 5px;">Code Snippet</div>
<div style="background:#ddd;max-height:300px;overflow:auto;padding:0;">
<ol style="background:#ffffff;white-space:wrap;margin:0 0 0 35px;">
<li> <span style="color:#0000ff;">&lt;?</span><span style="color:#a31515;">xml</span><span style="color:#0000ff;"> </span><span style="color:#ff0000;">version</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">1.0</span>&#8220;<span style="color:#0000ff;"> </span><span style="color:#ff0000;">encoding</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">utf-8</span>&#8220;<span style="color:#0000ff;"> ?&gt;</span></li>
<li style="background:#f3f3f3;"> <span style="color:#0000ff;">&lt;</span><span style="color:#a31515;">configuration</span><span style="color:#0000ff;">&gt;</span></li>
<li>   <span style="color:#0000ff;">&lt;</span><span style="color:#a31515;">system.serviceModel</span><span style="color:#0000ff;">&gt;</span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">  &lt;</span><span style="color:#a31515;">services</span><span style="color:#0000ff;">&gt;</span></li>
<li>   <span style="color:#0000ff;">    &lt;</span><span style="color:#a31515;">service</span><span style="color:#0000ff;"> </span><span style="color:#ff0000;">name</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">WcfPlay1.CalcService</span>&#8220;<span style="color:#0000ff;"> </span><span style="color:#ff0000;">behaviorConfiguration</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">svcBehavior</span>&#8220;<span style="color:#0000ff;">&gt;</span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">      &lt;</span><span style="color:#a31515;">endpoint</span><span style="color:#0000ff;"> </span><span style="color:#ff0000;">address</span><span style="color:#0000ff;">=</span>&#8220;&#8221;<span style="color:#0000ff;"> </span><span style="color:#ff0000;">binding</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">netTcpBinding</span>&#8220;<span style="color:#0000ff;"> </span><span style="color:#ff0000;">contract</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">WcfPlay1.ICalcService</span>&#8220;<span style="color:#0000ff;"> </span><span style="color:#ff0000;">bindingConfiguration</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">MyBinding</span>&#8220;<span style="color:#0000ff;">&gt;&lt;/</span><span style="color:#a31515;">endpoint</span><span style="color:#0000ff;">&gt;</span></li>
<li>   <span style="color:#0000ff;">      &lt;</span><span style="color:#a31515;">host</span><span style="color:#0000ff;">&gt;</span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">        &lt;</span><span style="color:#a31515;">baseAddresses</span><span style="color:#0000ff;">&gt;</span></li>
<li>   <span style="color:#0000ff;">          &lt;</span><span style="color:#a31515;">add</span><span style="color:#0000ff;"> </span><span style="color:#ff0000;">baseAddress</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">net.tcp://localhost:100/CalcService</span>&#8220;<span style="color:#0000ff;">/&gt;</span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">        &lt;/</span><span style="color:#a31515;">baseAddresses</span><span style="color:#0000ff;">&gt;</span></li>
<li>   <span style="color:#0000ff;">      &lt;/</span><span style="color:#a31515;">host</span><span style="color:#0000ff;">&gt;</span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">    </span></li>
<li>   <span style="color:#0000ff;">    </span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">    &lt;/</span><span style="color:#a31515;">service</span><span style="color:#0000ff;">&gt;</span></li>
<li>   <span style="color:#0000ff;">    </span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">  &lt;/</span><span style="color:#a31515;">services</span><span style="color:#0000ff;">&gt;</span></li>
<li>   <span style="color:#0000ff;">  &lt;</span><span style="color:#a31515;">behaviors</span><span style="color:#0000ff;">&gt;</span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">    &lt;</span><span style="color:#a31515;">serviceBehaviors</span><span style="color:#0000ff;">&gt;</span></li>
<li>   <span style="color:#0000ff;">      &lt;</span><span style="color:#a31515;">behavior</span><span style="color:#0000ff;"> </span><span style="color:#ff0000;">name</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">svcBehavior</span>&#8220;<span style="color:#0000ff;">&gt;</span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">        &lt;</span><span style="color:#a31515;">serviceAuthorization</span><span style="color:#0000ff;"> </span><span style="color:#ff0000;">serviceAuthorizationManagerType</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">WcfPlay1.CalcServiceAuthMgr,WcfPlay1</span>&#8220;<span style="color:#0000ff;"> /&gt;</span></li>
<li>   <span style="color:#0000ff;">      &lt;/</span><span style="color:#a31515;">behavior</span><span style="color:#0000ff;">&gt;</span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">    &lt;/</span><span style="color:#a31515;">serviceBehaviors</span><span style="color:#0000ff;">&gt;</span></li>
<li>   <span style="color:#0000ff;">  &lt;/</span><span style="color:#a31515;">behaviors</span><span style="color:#0000ff;">&gt;</span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">  &lt;</span><span style="color:#a31515;">client</span><span style="color:#0000ff;">&gt;</span></li>
<li>   <span style="color:#0000ff;">    &lt;</span><span style="color:#a31515;">endpoint</span><span style="color:#0000ff;"> </span><span style="color:#ff0000;">address</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">net.tcp://localhost:100/CalcService</span>&#8220;<span style="color:#0000ff;"> </span><span style="color:#ff0000;">binding</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">netTcpBinding</span>&#8220;<span style="color:#0000ff;"> </span><span style="color:#ff0000;">contract</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">WcfPlay1.ICalcService</span>&#8220;<span style="color:#0000ff;"> </span><span style="color:#ff0000;">bindingConfiguration</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">MyBinding</span>&#8220;<span style="color:#0000ff;"> /&gt;</span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">  &lt;/</span><span style="color:#a31515;">client</span><span style="color:#0000ff;">&gt;</span></li>
<li>   <span style="color:#0000ff;">  &lt;</span><span style="color:#a31515;">bindings</span><span style="color:#0000ff;">&gt;</span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">    &lt;</span><span style="color:#a31515;">netTcpBinding</span><span style="color:#0000ff;">&gt;</span></li>
<li>   <span style="color:#0000ff;">      &lt;</span><span style="color:#a31515;">binding</span><span style="color:#0000ff;"> </span><span style="color:#ff0000;">name</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">MyBinding</span>&#8220;<span style="color:#0000ff;">&gt;</span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">        &lt;</span><span style="color:#a31515;">security</span><span style="color:#0000ff;"> </span><span style="color:#ff0000;">mode</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">Transport</span>&#8220;<span style="color:#0000ff;">&gt;</span></li>
<li>   <span style="color:#0000ff;">          &lt;</span><span style="color:#a31515;">transport</span><span style="color:#0000ff;"> </span><span style="color:#ff0000;">clientCredentialType</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">Windows</span>&#8220;<span style="color:#0000ff;"> /&gt;</span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">        &lt;/</span><span style="color:#a31515;">security</span><span style="color:#0000ff;">&gt;</span></li>
<li>   <span style="color:#0000ff;">      &lt;/</span><span style="color:#a31515;">binding</span><span style="color:#0000ff;">&gt;</span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">    &lt;/</span><span style="color:#a31515;">netTcpBinding</span><span style="color:#0000ff;">&gt;</span></li>
<li>   <span style="color:#0000ff;">  &lt;/</span><span style="color:#a31515;">bindings</span><span style="color:#0000ff;">&gt;</span></li>
<li style="background:#f3f3f3;">   <span style="color:#0000ff;">&lt;/</span><span style="color:#a31515;">system.serviceModel</span><span style="color:#0000ff;">&gt;</span></li>
<li> <span style="color:#0000ff;">&lt;/</span><span style="color:#a31515;">configuration</span><span style="color:#0000ff;">&gt;</span></li>
</ol>
</div>
</div>
</div>
<p>&#160;</p>
<p>following is the hosing code… you can write in any function like Button click etc…</p>
<p>I’ve written in console application, so if i run the application, my services are up.</p>
<div style="padding:5px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:f27989fe-90fe-4c16-b54b-ea0c9b00c4a8" class="wlWriterEditableSmartContent">
<div style="border:#000080 1px solid;font-family:'Courier New', Courier, Monospace;font-size:10pt;">
<div style="background:#000080;color:#fff;font-family:Verdana, Tahoma, Arial, sans-serif;font-weight:bold;padding:2px 5px;">Code Snippet</div>
<div style="background:#ddd;max-height:300px;overflow:auto;padding:0;">
<ol style="background:#ffffff;white-space:wrap;margin:0 0 0 25px;">
<li>  <span style="color:#2b91af;">ServiceHost</span> host = <span style="color:#0000ff;">new</span> <span style="color:#2b91af;">ServiceHost</span>(<span style="color:#0000ff;">typeof</span>(<span style="color:#2b91af;">CalcService</span>), <span style="color:#0000ff;">new</span> <span style="color:#2b91af;">Uri</span>[] { });</li>
<li style="background:#f3f3f3;">             host.Open();</li>
<li>             <span style="color:#2b91af;">Console</span>.WriteLine(<span style="color:#a31515;">&#8220;Hosted&#8221;</span>);</li>
</ol>
</div>
</div>
</div>
<p>&#160;</p>
<p>Now we have everything. Now we can call this service. </p>
<p>Now I’m create proxy call to call my service. <strong>Following is the code to create proxy class</strong>. After we create proxy class, user can create the object of that and call the actual services.</p>
<div style="padding:5px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:8959eee7-f6d6-4834-91a8-a07282f38780" class="wlWriterEditableSmartContent">
<div style="border:#000080 1px solid;font-family:'Courier New', Courier, Monospace;font-size:10pt;">
<div style="background:#000080;color:#fff;font-family:Verdana, Tahoma, Arial, sans-serif;font-weight:bold;padding:2px 5px;">Code Snippet</div>
<div style="background:#ddd;max-height:300px;overflow:auto;padding:0;">
<ol style="background:#ffffff;white-space:wrap;margin:0 0 0 35px;">
<li> <span style="color:#0000ff;">class</span> <span style="color:#2b91af;">CalcServiceClient</span> : <span style="color:#2b91af;">ClientBase</span>&lt;<span style="color:#2b91af;">ICalcService</span>&gt;, <span style="color:#2b91af;">ICalcService</span></li>
<li style="background:#f3f3f3;">     {</li>
<li> </li>
<li style="background:#f3f3f3;">         <span style="color:#0000ff;">#region</span> ICalcService Members</li>
<li>      </li>
<li style="background:#f3f3f3;">         <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">int</span> Add(<span style="color:#0000ff;">int</span> i, <span style="color:#0000ff;">int</span> j)</li>
<li>         {</li>
<li style="background:#f3f3f3;">             <span style="color:#0000ff;">return</span> <span style="color:#0000ff;">base</span>.Channel.Add(i, j);</li>
<li>         }</li>
<li style="background:#f3f3f3;"> </li>
<li>         <span style="color:#0000ff;">#endregion</span></li>
<li style="background:#f3f3f3;">     }</li>
</ol>
</div>
</div>
</div>
<p>Now proxy is ready. We can call the service following way…</p>
<p>&#160;</p>
<div style="padding:5px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:01974c4a-70c3-497c-abbb-c9d07beabd40" class="wlWriterEditableSmartContent">
<div style="border:#000080 1px solid;font-family:'Courier New', Courier, Monospace;font-size:10pt;">
<div style="background:#000080;color:#fff;font-family:Verdana, Tahoma, Arial, sans-serif;font-weight:bold;padding:2px 5px;">Code Snippet</div>
<div style="background:#ddd;max-height:300px;overflow:auto;padding:0;">
<ol style="background:#ffffff;white-space:wrap;margin:0 0 0 35px;">
<li>  <span style="color:#2b91af;">CalcServiceClient</span> client = <span style="color:#0000ff;">new</span> <span style="color:#2b91af;">CalcServiceClient</span>();</li>
<li style="background:#f3f3f3;">             <span style="color:#0000ff;">int</span> res = 0;</li>
<li>             <span style="color:#0000ff;">try</span></li>
<li style="background:#f3f3f3;">             {</li>
<li>                 res = client.Add(10, 5);</li>
<li style="background:#f3f3f3;">             }</li>
<li>             <span style="color:#0000ff;">catch</span> (<span style="color:#2b91af;">Exception</span> ex)</li>
<li style="background:#f3f3f3;">             {</li>
<li>                 <span style="color:#2b91af;">Console</span>.WriteLine(ex.ToString());</li>
<li style="background:#f3f3f3;">             }</li>
<li> </li>
<li style="background:#f3f3f3;">             <span style="color:#2b91af;">Console</span>.WriteLine(res.ToString());</li>
<li>             <span style="color:#2b91af;">Console</span>.ReadLine();</li>
</ol>
</div>
</div>
</div>
<p>Now I’m going to call my service directly means not creating the proxy class..</p>
<p>Following is the code….</p>
<p>&#160;</p>
<div style="padding:5px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:3f462716-b190-4163-a022-6336a9f4c6fa" class="wlWriterEditableSmartContent">
<div style="border:#000080 1px solid;font-family:'Courier New', Courier, Monospace;font-size:10pt;">
<div style="background:#000080;color:#fff;font-family:Verdana, Tahoma, Arial, sans-serif;font-weight:bold;padding:2px 5px;">Code Snippet</div>
<div style="background:#ddd;max-height:300px;overflow:auto;padding:0;">
<ol style="background:#ffffff;white-space:wrap;margin:0 0 0 35px;">
<li> <span style="color:#0000ff;">private</span> <span style="color:#0000ff;">static</span> <span style="color:#0000ff;">void</span> CallServiceChannelFactory()</li>
<li style="background:#f3f3f3;">         {</li>
<li>             <span style="color:#2b91af;">NetTcpBinding</span> netTcpBinding = <span style="color:#0000ff;">new</span> <span style="color:#2b91af;">NetTcpBinding</span>();</li>
<li style="background:#f3f3f3;">             <span style="color:#2b91af;">EndpointAddress</span> address = <span style="color:#0000ff;">new</span> <span style="color:#2b91af;">EndpointAddress</span>(<span style="color:#a31515;">&#8220;net.tcp://localhost:100/CalcService&#8221;</span>);</li>
<li>             <span style="color:#2b91af;">ChannelFactory</span>&lt;<span style="color:#2b91af;">ICalcService</span>&gt; myChannelFactory = <span style="color:#0000ff;">new</span> <span style="color:#2b91af;">ChannelFactory</span>&lt;<span style="color:#2b91af;">ICalcService</span>&gt;(netTcpBinding, address);</li>
<li style="background:#f3f3f3;"> </li>
<li>             <span style="color:#2b91af;">ICalcService</span> WcfClient = myChannelFactory.CreateChannel();</li>
<li style="background:#f3f3f3;">             <span style="color:#0000ff;">int</span> j = WcfClient.Add(10, 40);</li>
<li>             <span style="color:#2b91af;">Console</span>.WriteLine(<span style="color:#a31515;">&#8220;For Channel&#8221;</span>);</li>
<li style="background:#f3f3f3;">             <span style="color:#2b91af;">Console</span>.WriteLine(j.ToString());</li>
<li>         }</li>
</ol>
</div>
</div>
</div>
<p>Now i think you are clear how to access the services…</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/miteshisheth.wordpress.com/185/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/miteshisheth.wordpress.com/185/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/miteshisheth.wordpress.com/185/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/miteshisheth.wordpress.com/185/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/miteshisheth.wordpress.com/185/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/miteshisheth.wordpress.com/185/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/miteshisheth.wordpress.com/185/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/miteshisheth.wordpress.com/185/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/miteshisheth.wordpress.com/185/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/miteshisheth.wordpress.com/185/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/miteshisheth.wordpress.com/185/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/miteshisheth.wordpress.com/185/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/miteshisheth.wordpress.com/185/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/miteshisheth.wordpress.com/185/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=miteshisheth.wordpress.com&amp;blog=8485788&amp;post=185&amp;subd=miteshisheth&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://miteshisheth.wordpress.com/2009/12/10/wcf-factorychannel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bf7c284e28c7cddce77364c96cbb203c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">miteshisheth</media:title>
		</media:content>
	</item>
	</channel>
</rss>
