App_Offline Updates in Webdeploy V3 and Visual Studio 2013
Jan10

App_Offline Updates in Webdeploy V3 and Visual Studio 2013

Welcome to CodeSpread! Please refer Don’t Mess with App_Offline article to see the usefulness of App_Offline. Treat the below article as an update to the concepts and basics shared earlier. After going through visual studio 2013 updates available across the web, I found some interesting notes related to app_offline at http://www.iis.net/learn/publish/deploying-application-packages/taking-an-application-offline-before-publishing http://blogs.msdn.com/b/webdev/archive/2013/10/30/web-publishing-updates-for-app-offline-and-usechecksum.aspx To summarize both the articles, An “AppOffline” rule was added to Web Deploy V3, This rule is disabled by default and needs to be enabled for taking an application offline. Example to be run on command line: msdeploy.exe -verb:sync -source:iisApp=mySite -dest:auto,computername= -enableRule:AppOffline Now, the above logic is integrated with visual studio 2013 where the rule can be enabled  in .pubxml file associated to corresponding publish profile.These web publish profiles are stored as MSBuild files under Properties\PublishProfiles Add the following element in the PropertyGroup element. <EnableMSDeployAppOffline>true</EnableMSDeployAppOffline> So the resulting publish profile will look something like the following. <!--?<span class="hiddenSpellError" pre=""-->xml version="1.0" encoding="utf-8"?&gt; &lt;Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&gt; &lt;PropertyGroup&gt; &lt;EnableMSDeployAppOffline&gt;true&lt;/EnableMSDeployAppOffline&gt; &lt;WebPublishMethod&gt;MSDeploy&lt;/WebPublishMethod&gt; &lt;MSDeployServiceURL&gt;(removed)&lt;/MSDeployServiceURL&gt; &lt;DeployIisAppPath&gt;Default Web Site&lt;/DeployIisAppPath&gt; &lt;AllowUntrustedCertificate&gt;True&lt;/AllowUntrustedCertificate&gt; &lt;SkipExtraFilesOnServer&gt;True&lt;/SkipExtraFilesOnServer&gt; &lt;DeployAsIisApp&gt;False&lt;/DeployAsIisApp&gt; &lt;MSDeployPublishMethod&gt;WMSVC&lt;/MSDeployPublishMethod&gt; &lt;UserName&gt;sayedha&lt;/UserName&gt; &lt;ExcludeApp_Data&gt;False&lt;/ExcludeApp_Data&gt; &lt;_SavePWD&gt;True&lt;/_SavePWD&gt; &lt;/PropertyGroup&gt; &lt;/Project&gt;...

Read More
IIRF.ini for URL rewriting
Jul22

IIRF.ini for URL rewriting

We often hear the terms like URL rewriting or friendly URLs. There are many techniques available to achieve it and we will discuss one of those today, IIRF. What is URL rewriting? Before we try to understand URL rewriting, we should first understand a term called SEO friendly URLs,Read more about it here. When Google and Yahoo spiders start indexing the page, they take various parameters in account for indexing the page and one of the most important parameter is URL. URL should be more user friendly and human readable. For example, A URL like codespread.com/article?p=123 is not human readable or user friendly, it should be rewritten something like codespread/article/know-url to get a better search ranking/indexing. Above explanation fulfils the need of URL rewriting. How can it be achieved? URL rewriting can be achieved by either with ISAPI filters at the IIS Web server level, or with either HTTP modules or HTTP handlers at the ASP.NET level. We are going to focus on ISAPI filter at the IIS web server level. We have a free and open source ISAPI filter for IIS URL rewriting from Ionic: IIRF: Ionic’s ISAPI Rewriting Filter. It installs as an ISAPI Filter on the IIS server. Note:IIS servers do not support URL rewriting by default. IIS7 servers support native component for URL rewriting. Refer this beautiful article to install ISAPI filter. http://wiki.gxtechnical.com/commwiki/servlet/hwiki?How+to+install+URL+Rewrite, In IIS7, URL rewrite will be seen as, In II6, IIRF.dll can be seen inside ISAPI filters property. Both option uses IIRF.dll for basic filter. After this, we just need to edit the configuration file ‘IIRF.ini’ to establish rules. What is IIRF.ini? ‘ini’ file is a simple text file with an extension of ‘Initialization’. It provides the settings for the sites which is the configuration information normally referred to as the rules. These rules describe how to rewrite or redirect URLs and headers. For each site,at least one IIRF.ini is necessary. It is required to locate the IIRF.ini file in the root physical path for each web site or web application. IIRF uses regular expression for rules like \d, \D, \w, \W, \s, \S. An example: This is a basic introduction to IIRF. There is more information and examples available at...

Read More
IIS- Still learning!
Dec17

IIS- Still learning!

Whenever we receive some error which is related to IIS, we just jump on internet as we lack the basic concepts of IIS and i can definitely say that we almost ignore IIS and focus ourselves on development and coding. Then Why not learn IIS today? I would share my knowledge and request all of you to share your bit or you can send your articles/abstracts to admin@codepsread.com also. What is IIS? IIS- Wikipedia says “Internet Information Services (IIS) – formerly called Internet Information Server – is an app server application and set of feature extension modules created by Microsoft for use with Microsoft Windows.” Just check out the terms, application, set of feature extension modules, this means it is a program or component running on a windows platform which provides us all the features or additional features required to host our website. In real world, a regular machine running a windows server operating system is equivalent to a ‘server’ and if IIS is installed on this server and sites are hosted on IIS, then this server will be equivalent to web server. Simple enough! It is a Microsoft product so it is tightly coupled to Windows platform and second it was targeted to compete in Internet server market with already existing giants like Apache, so it has captured all the existing features and provided additional features also. What is the role of IIS? Role is played by a character in a story, IIS is our character here, and the story is Application Life Cycle. In this story, there are many characters and IIS is the first and major character which plays host to any request coming to it and sends it to the processing pipelines. Figure shows communication of client and server over HTTP , server receives requests on Port 80 and if the protocol is HTTPS, port will be 443. Although, I have skipped the DNS part but we will cover it sometime in future. How IIS looks like? Go to Windows->Run->type inetmgr [Before that check whether IIS is installed or enabled on your system, Refer this article] IIS Panel has three groups: ASP.Net, IIS and Management. Out of these 3, two are visible in above image. ASP.NET Includes tasks related to managing tasks related to ASP.NET like connection strings,SMTP email etc. IIS Includes tasks related to managing sites and applications  like Modules, Handlers etc. Management Includes tasks related to configuring administrative roles, delegation, and remote administration. How it works? Once the request is received by IIS, it follows the below process. IIS runs a process, inetinfo.exe, which processes the request as per its state like static...

Read More

How to add alias and create virtual directory?

There is a term very famous in IIS world ‘virtual directory’, but before discussing a virtual directory, we should be familiar with the term ‘alias’.By definition, an object can have alternative name. If we have a directory like “C:\Projects\Web” , then we can give or specify an alternative name for it like “Web” instead of mentioning full path. Lets create a project, put the files at the location mentioned above and just a tweak on IIS and voila! virtual directory is ready. So what’s this tweak? Open your IIS, inetmgr.exe Right click on your website and select “Add Virtual Directory”. Provide the directory path in the open dialog box, give an alias name to the directory. That’s all what is needed to create a virtual directory. This virtual directory is used with the localhost url like “http://localhost/Web/” to reach out the pages stored in the directory “C:\Projects\Web.” Note : By Default, “http://locahost” refers to the directory...

Read More
IIS Pre-Article
Dec16

IIS Pre-Article

I thought of sharing few articles on IIS so when I started my mission, I realized that there should be some basic tasks related to IIS which needs to be done by the user before diving deep into IIS, So here is the first pre-article. Check whether IIS is installed or not? Go to Start->Run type inetmgr and press OK Check, if this screen appears.   Second way to check. Go to Control Panel > Programs and Features > and look for IIS in the list of installed components. Third way to check. Go to Run->Services.msc and enter check for the IIS ADMIN service in this services window.   If any of these options doesn’t show the desired screen , Either IIS is not enabled or installed or corrupted. How can IIS be turned ON? Control Panel > Programs and Features > Turn Windows Features On or Off > Check IIS box.   Installation of IIS: IIS is tightly coupled to operating system on which it is going to run for ex: 5.0 Built-in component of Windows 2000. Windows 2000 5.1 Built-in component of Windows XP Professional. Windows XP Professional 6.0 Built-in component of Windows Server 2003. WIndows Server 2003 7.0 Built-in component of Windows Vista and Windows Server 2008. Windows Vista and WIndows Server 2008 7.5 Built-in component of Windows Server 2008 R2/ Windows7 [Not basic edition] refer: http://support.microsoft.com/kb/224609 So, our headache is over, there is no need to install IIS as it comes with IIS pre-installed, we just have to turn it ON. Thanks Guys! Wait for the IIS...

Read More