Welcome to MSDN Blogs Sign in | Join | Help

News

  • These postings are provided "AS IS" with no warranties, and confer no rights. Use of included code samples are subject to the terms specified Terms of Use
Tip#99: Did you know… You can now install new Media and Developer Tools products with Web PI v2 RTW?

RTW version 2 of Web PI, which shipped in September, now offers additional products through Media and Developer Tools scenarios through the new Options Dialog. You can include products from these scenarios from the Options dialog:

image

and check the corresponding checkboxes:

clip_image004[4]


Katerina Rohonyan
SDET | IIS Team

Tip#98: Did you know… The default Application Pool Identity in IIS 7.5 (Windows 7) changed from NetworkService to AppPoolIdentity?

In Windows 7, IIS application pool isolation was taken yet to a different level. The new change introduced in IIS7 (Windows Server 2008) was a new option to run your application pool as AppPoolIdentiy. However, the default for an application pool identity in IIS7 remained the same – NetworkService. In IIS7.5, AppPoolIdentiy becomes a default. Thus, scripts previously expecting permissions for their application pool identity to be set to “NT Service\NetworkService” will now have to set permissions (ACLs) for “IIS AppPool\<app pool name>” – the user account created for each new application pool. 

Thus, to set permissions for the DefaultAppPool, the scripts will need to set ACLs for “IIS AppPool\DefaultAppPool”.

The incentive behind this change was to enforce the improved concept of process isolation through separate user accounts generated for each application pool identity.

To see other options that you can choose for your application pool identity, go to IIS Manager, Application Pools and right-click on the pool you want to configure, select Advanced Settings and Identity in the dialog that opens. You can choose one of the built-in accounts for your application pool identity:

image

Here is a list of built-in accounts and their corresponding usernames to use when setting permissions:

LocalService:                Service
LocalSystem:                System 
NetworkService:           Network Service
ApplicationPoolIdentity: IIS AppPool\<app pool name>

You can also specify an existing custom account (local or domain):

image

To read more about how to configure Application Pool Identities refer to this iis.net article: Application Pool Identities
To read about changes in application pool identities with regard to NetworkService account, read this blog post: Goodbye Network Service!

Katerina Rohonyan
SDET | IIS Team

Tip#97: Did you know… How to Display Hidden Information in Design View

The design view in Visual Studio can display glyphs and borders for the hidden non - graphic elements (such as div, span, form, and script elements). This feature helps you to see where the elements are and avoid inadvertently deleting the non-graphic elements from your page while editing.

To enable it in designer click on View -> Formatting Marks -> Show

image

 

Now you will start seeing the hidden elements on the designer surface.

 

image

 

Hope this helps,

Deepak Verma
SDET | Visual Web Developer

Tip#96: Did you know…You could publish your SQL databases using the SQL Publishing Wizard?

You can use the SQL Publishing wizard in VS 2008/VWD 2008 to deploy a local database from your development machine to a hosting environment on a remote machine.

This is how you will accomplish this:

Step 1: Create a new web site by selecting menu File ->New Web Site. Switch to Server Explorer and add a new Data connection and connect to a database. In this case we will use the Northwind database that comes with SQL Express. You should point to the database you want to publish.

Step 2: Select Northwind.dbo node in Server explorer and right click to bring up the context menu. In the Context menu you have a “Publish to provider…” option.

Step 3: Click “Publish to provider …” to launch the Database Publishing Wizard.

Step 4: Click Next to select the mode. Let us go with “Script to file” mode. We will need to specify the .SQL file name and location.

Step 5: Click Next and you will get to the Publishing Options. On this page, select the script for target database (SQL Server 2000 or SQL Server 2005) and the types of data to publish (Schema, Data or Schema+Data). You also have the option to drop existing object in script if you want to.

Step 6: Keep the default selection and hit next and generate the .SQL script.

Step 7: The .SQL file generated contains a script that you can run on any SQL server to re-create all the tables, sprocs, views, triggers, full-text catalogs, etc. for a database, as well as import and add all of the table row data that was in the database at the time the .SQL file was created.

Step 8: The .SQL file is a plain text file. You can open it in your favorite editor and customize it as you need.

Step 9: Now that we have our .SQL files, we can go about using them to install our database at our hoster. Exactly how to install the .SQL files will vary depending on how the hoster give access to our SQL account.  Some hosters provide an HTML based file-upload tool that allows you to provide a .SQL file - which they will then execute against the SQL database you own. 

Other hosters provide an online query tool (like below) that allows you to copy/paste SQL statements to run against your database.  If you have a hoster which provides an online query tool like this, then you can open the .SQL file with a text-editor and copy/paste the contents into the query textbox and run it.

You can find my original post  here.

Reshmi Mangalore
SDET, Visual Web Developer.

Tip #95: Did you know… That Web Application Projects and Class libraries are now available in Express edition?

Creating a Web Application Project was possible only in VS standard SKU and above in VS 2008.

But with VS 2008 SP1 we went ahead and added support for WAP and class libraries in Visual Web Developer Express edition SP1. You can now create WAPs by going to File –> New Project.

WAP in Express

Reshmi Mangalore
SDET, Visual Web Developer.

Tip #94: Did you know … How to improve the performance of PHP application on Windows?

Today the Microsoft IIS team has released the beta of the Windows Cache Extension 1.0 for PHP.

The Windows Cache Extension for PHP is a PHP accelerator, that is used to increase the speed of PHP applications running on the Windows operating systems.

Any PHP application can take advantage of the functionality provided by the Windows Cache Extension for PHP without any code modifications. All that is required is that the extension is enabled and loaded by the PHP engine.

Install the Windows Cache Extension 1.0 for PHP - Beta

clip_image002

or, download:

Windows Cache Extension 1.0 for PHP 5.2 - Beta

Windows Cache Extension 1.0 for PHP 5.3 – Beta

Follow the instructions at "Using Windows Cache Extension for PHP" to install, enable and configure the extension.

Note:

  • The extension can only be used with non-thread-safe builds of PHP
  • The extension can only be used when IIS is configured to run PHP via FastCGI
  • The Windows Cache Extension 1.0 for PHP 5.3 can only be used with the x86 VC9 build of PHP 5.3.
Benefits and Features

The extension includes three caches that can be enabled or disabled independently of each other:

  • PHP opcode cache - PHP is a script processing engine, which reads an input stream of data that contains text and/or PHP instructions and produces another stream of data, most commonly in the HTML format. This means that on a web server the PHP engine reads, parses, compiles and executes a PHP script each time that it is requested by a Web client. The reading, parsing and compilation operations put additional load on the web server's CPU and file system and thus affect the overall performance of a PHP web application. The PHP bytecode (opcode) cache is used to store the compiled script bytecode in shared memory so that it can be re-used by PHP engine for subsequent executions of the same script.
  • File cache - Even with the PHP bytecode cache enabled, the PHP engine has to accesses the script files on a file system. When PHP scripts are stored on a remote UNC file share, the file operations introduce a significant performance overhead. The Windows Cache Extension for PHP includes a file cache that is used to store the content of the PHP script files in shared memory, which reduces the amount of file system operations performed by PHP engine.
  • Relative file path cache - PHP scripts very often include or operate with files by using relative file paths. Every relative file path has to be converted to an absolute file path by the PHP engine. When a PHP application uses many PHP files and accesses them by relative paths, the operation of resolving relative paths to absolute paths may negatively impact the application's performance. The Windows Cache Extension for PHP provides a Relative File Path cache, which is used to store the mappings between relative and absolute file paths, thereby reducing the number of relative path resolutions that the PHP engine has to perform.
More information

Use the Windows Cache Extension for PHP Forum to ask questions, report bugs and provide feature suggestions.

Don Raman
SDET, IIS Team

Tip #93: Did you know … PHP and Custom Error Pages configuration?

When deploying PHP web applications that handle their errors with their own error pages, the existingResponse for Custom Error Pages feature of IIS should be set to “PassThrough” for that particular site. This greatly improves the customer experience when accessing your new application, particularly if your custom error pages are merely the defaults that come with IIS.

Custom Error Pages set to “Auto” (the default):

scratch1

Custom Error Pages set to “PassThrough”:

scratch2

This property can be set for either the site in particular or the server as a whole. To set it for the server, using appcmd.exe (found in %windir%\system32\inetsrv), the command is

appcmd.exe set config -section:system.webServer/httpErrors /existingResponse:"PassThrough" /commit:apphost

However, you can also do this on a per site, application, or virtual directory basis as well. Using appcmd, use the following command:

appcmd.exe set config "Default Web Site/application" -section:system.webServer/httpErrors /existingResponse:"PassThrough"

Replace “Default Web Site/application” with the actual path to your desired location to change.

You can also do this by editing (and creating if needed) a web.config file in the actual folder of the location, which would look something like this:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <httpErrors existingResponse="PassThrough" />
    </system.webServer>
</configuration>

And voila, you’re done!

 

Kern Handa | SDET | IIS Team

Tip #92: Did you know … How to select a master page using 'Select a Master Page' dialog?

Master page for a Web form can always be set manually in the source code, but here is an option to select the master page while create the webform using the 'Select a Master Page' dialog.

The path to select a Master page using the 'Select a master page' dialog is different for a Web application project than for a Web site.

 
For a Web Application project:

  1. Right click solution explore. Select Add and then select New Item

    image

  2. From the Add new Item dialog select Web content form and click on Add button.

    image
  3. Select a Master Page dialog would appear. Navigate thru the project folders to select the Master page & click on OK button. The aspx added would now be using the selected master page.

    image

 
For a Web site project:

  1. While adding a Webform, check the select master page checkbox and click on the Add button.

    image
  2. Select a Master Page dialog would appear. Navigate thru the project folders to select the Master page & click on OK button. The aspx added would now be using the selected master page.

    image

Hope this helps,

Deepak Verma
SDET | Visual Web Developer

Tip #91: Did you know … How to automate FTP 7.5 installation and site creation?

With the imminent release of Windows 7 and Server 2008 R2 to the general public, some of you may want to automate the installation FTP 7.5 on the machine. Thanks to pkgmgr, this is made amazingly simple!
To install both the UI and the FTP service, simply run the following command in an elevated cmd shell:

cmd /c "pkgmgr /iu:IIS-FTPSvc;IIS-FTPExtensibility”

However, for a more lightweight installation where you just want to install the service, this is possible via:

cmd /c "pkgmgr /iu:IIS-FTPSvc”

On this line of thinking about automating simple and common tasks, here’s a simple batch script that sets up a basic ftp site on port 21 with a data directory at C:\inetpub\ftproot (can be a different drive depending on system) and allows read/write access to all users who already have access to the would-be server. NOTE: NO FURTHER SECURITY IS IN PLACE.

You can copy and paste this directly into an elevated cmd shell window or make a batch file out of it to distribute it across multiple machines or change the values of the variables (ftproot and ftpsite).

cd %windir%\system32\inetsrv 
REM ftproot is the location of the ftp data directory 
set ftproot=%systemdrive%\inetpub\ftproot 
REM ftpsite is the name of the ftp site 
set ftpsite="ftp site" 
if not exist "%ftproot%" (mkdir "%ftproot%") 
cacls "%ftproot%" /G IUSR:W /T /E 
appcmd add site /name:%ftpsite% /bindings:ftp://*:21 /physicalpath:"%ftproot%" 
appcmd set config -section:system.applicationHost/sites /[name='%ftpsite%'].ftpServer.security.ssl.controlChannelPolicy:"SslAllow" 
appcmd set config -section:system.applicationHost/sites /[name='%ftpsite%'].ftpServer.security.ssl.dataChannelPolicy:"SslAllow" 
appcmd set config -section:system.applicationHost/sites /[name='%ftpsite%'].ftpServer.security.authentication.basicAuthentication.enabled:true 
appcmd set config %ftpsite% /section:system.ftpserver/security/authorization /+[accessType='Allow',permissions='Read,Write',roles='',users='*'] /commit:apphost 

The site created allows any user that has access to the machine to login remotely with his Windows credentials. He also has both read and write access to the folder (ftproot). The site does block against anonymous user logins, though. Furthermore, while SSL is allowed, it is not required, meaning clients are not required to connect over an encrypted channel.

Kern Handa | SDET | IIS Team

Tip #90: Did you know … How to rearrange menu items in Visual Web Developer?

You can use the Rearrange Commands dialog box to do this. To get there:

Launch the Tools->Customize dialog. Now select the Commands Tab.

Customize Dialog

Click on the Rearrange commands… button, and this will launch the dialog that will help you with arranging your menu and toolbar items. Now choose a menu or toolbar to rearrange. You can rearrange the items by selecting them and moving them up and down. You can also use this dialog to add your own menu options.

Rearrange Commands Dialog:

Rearrange Commands Dialog

 

Reshmi Mangalore,

SDET, Visual Web Developer.

Tip #89: Did you know…You could customize Toolbars in Visual Web Developer?

Visual Web Developer by default shows the standard toolbar. To expose the remaining tool bars, you will have to right click on the standard tool bar area. This will bring up the list of all toolbars available. Select in this list to show or hide toolbars. In the picture below, I have chosen the formatting toolbar and the HTML Source Editing toolbars to be shown.

View Toolbars

You can further customize the tool bar using the Tools->Customize menu option. This will launch the Customize dialog box.This dialog gives you the option to Use large Icons, Show Screen Tips on Toolbars and Show shortcut keys in ScreenTips.

 Customize Dialog - Toolbars Tab

Reshmi Mangalore

SDET, Visual Web Developer.

Tip #88: Did you know… To not stress your server, limit the number of concurrent requests

The other day somebody ask me if there was a way to limit the amount of work that Site Analysis in IIS SEO Toolkit would cause to the server. This is interesting for a couple of reasons,

  • You might want to reduce the load that Site Analysis cause to your server at any given time
  • You might have a Denial-of-service detection system such as our Dynamic IP Restrictions IIS module that will start failing requests based on number of requests in a certain amount of time
  • Or If you like me have to go through a Proxy and it has a configured limit of number of requests per minute you are allowed to issue

In Beta 1 we do not support the Crawl-delay directive in the Robots exclusion protocol; in future versions we will look at adding support this setting. The good news is that in Beta 1 we do have a configurable setting that can help you achieve this goals called Maximum Number of Concurrent Requests that you can configure.

To set it:

  1. Go to the Site Analysis Reports page
  2. Select the option "Edit Feature Settings..." as show in the next image
    image
  3. In the "Edit Feature Settings" dialog you will see the Maximum Number of Concurrent Requests option that you can set to any value from 1 to 16. The default value is 8 which means at any given time we will issue 8 requests to the server.
    image
Carlos Aguilar Mares, IIS Team

View the original post

Technorati Tags: ,,
Tip #87: Did you know… How to reuse a web page by converting into an ASP.NET User Control?

If you want to reuse a web form's content in other places in your application, you can easily convert the page into an ASP.NET User Control. Then you can add that user control to any other page.

For example, you have a page in your application that looks like the following:

WebForm

 

Now, you need to rename to the file to have a .ascx extension. Then remove html, head, body, form tags from the page. Change the "@ Page" directive to a "@ Control" directive.  Remove all attributes of the "@ Control" directive, except Language, AutoEventWireup, CodeFile, and Inherits. You also need the change the Inherits to have your new UserControl code behind file's name, like in the image below. Close and re-open the file to make squiggles go away.

MyUserControl 

 

If you have a code-behind file, its name will be changed properly for you automatically. Open the file and change the class it inherits from to UserControl, and the class name to match your .ascx file. See below.

MyUserControlCodeBehind

More information can be found here.

Tip #86: Did you know… Visual Studio has several different search options?

The standard methods for searching can be found under the Edit --> Find and Replace menu.

EditFindReplaceMenu

The “Quick Find” method (Ctrl+F) allows users to search inside of the current document, all open documents, the current project, the entire solution, and the current block by changing the Look in selection.

 

QuickFindLookIn

If you set Look in to be the current project or the entire solution, Visual studio will open files that have matches as you navigate between matches.

You can also adjust the settings under Find options to make the searches more specific by having them match on case or whole words or control how it searches by deciding whether it should search up or down or if it should look at hidden text (collapsed regions).

QuickFindFindOption

The Find in Files method (Ctrl+Shift+F) allows users to see all the occurrences of the search in one place, changes the Look in options by removing the current block, but allows users to search custom locations by using the “…” button next to the Look in drop down, and allows the user to restrict the types of files searched.

FindInFiles

If you use Ctrl+F or select the Quick Find option from the find and replace menu by mistake, hitting Ctrl+Shift+F or selecting the drop down in the upper left corner of the dialog and selecting Find In Files will quickly get you to the Find in Files dialog.

Using the Result options section you choose to have the results displayed in either the “Find Results 1” or “Find results 2” window. Allowing you to switch between results if needed.

The Find What field also keeps a history of searches. To access this history click the down arrow of the Find What field. You can avoid using the history or typing search terms by having the value you want to search for selected in the editor before opening one of the find dialogs.

Ben Byrd
SDET | Visual Web Developer

Tip#85: Did you know… You can now do Multiple Selection of controls in your Designer with VS 2008 SP1?

Visual Web developer 2008 SP1 supports multiple selection of controls on your designer using Ctrl+Click.

You can see that the designer:

  • Displays the primary selected control with a white tab. Button3 in the image below.
  • Enable you to set property for the selected controls using Property Grid. Note that the property grid would show you only the properties that are in common for all the selected controls.
  • Enables you to make use of the Align, Make Same Size and Order Menu commands in your Format Menu options.

However VWD 2008 SP1 does not support the ability to drag drop multiple controls and Cut/Copy/Paste of multiple elements.

MultipleSelection

Thanks!

Reshmi Mangalore

SDET, Visual Web Developer

More Posts Next page »
Page view tracker