Scott Hanselman

.NET 4 Web Application Startup Time

March 28, 2010 Comment on this post [15] Posted in ASP.NET | VS2010
Sponsored By

I was chatting with Jonathan Hawkins and some of the folks on the ASP.NET team about performance and Jonathan mentioned the startup time for large ASP.NET applications is improved on .NET 4. There are some improvements in the CLR and in ASP.NET itself that helped. If you have a giant app, you should do some tests.

The word from the ASP.NET team is that you'll see improvements when the .NET framework (CLR) is warm in memory but the Web App is cold on disk. This is for shared hosting scenarios where the web server is loading and unloading web applications while .NET remains in memory.

Web App Name

NETFX3.5 SP1

NETFX4

Change

Change as % of NETFX3.5

blogengine

1.959s

1.702s

(0.256s)

-13.08%

dasblog

3.151s

2.818s

(0.333s)

-10.58%

dotnetnuke

4.026s

3.621s

(0.406s)

-10.07%

screwturnwiki

1.579s

1.500s

(0.080s)

-5.03%

Median Improvement

(0.295s)

-10.32%

Environment: NETFX v4.0, Win7-x86, 7200 RPM, 4GB, 2 Cores

If you're interested in one of the reasons, there's a switch in C:\Windows\Microsoft.NET\Framework\v4.0.xxxx\Aspnet.config called shadowCopyVerifyByTimestamp that ASP.NET uses to startup up the CLR. The CLR optimized in .NET 4 how shadow copy assemblies are loaded by removing an unnecessary file copy if nothing's changed. Hence, part of the improvement in cold web app startup.

What's the biggest ASP.NET application that you've got?

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Hanselminutes Podcast 207 - Charles Petzold on Windows Phone 7 Series

March 26, 2010 Comment on this post [8] Posted in Mix | Podcast | WinPhone
Sponsored By

75685408My two-hundred-and-seventh podcast is up. Charles Petzold wrote the book on Windows. Specifically, he wrote "Programming Windows, 1st edition" in 1988. This was the book I learned on and I still have it on my shelf. Charles has never stopped writing and is now working on a free book for Microsoft Press called "Programming Windows Phone 7 Series." I get the scoop from Chuck in this interview recorded in the waning hours of Mix 10 in Las Vegas.

Subscribe: Subscribe to Hanselminutes Subscribe to my Podcast in iTunes

Download: MP3 Full Show

Links from the Show

Do also remember the complete archives are always up and they have PDF Transcripts, a little known feature that show up a few weeks after each show.

I want to add a big thanks to Telerik. Without their support, there wouldn't be a Hanselminutes. I hope they, and you, know that. Someone's gotta pay the bandwidth. Thanks also to Carl Franklin for all his support over these last 4 years!

Telerik is our sponsor for this show.

Building quality software is never easy. It requires skills and imagination. We cannot promise to improve your skills, but when it comes to User Interface and developer tools, we can provide the building blocks to take your application a step closer to your imagination. Explore the leading UI suites for ASP.NET AJAX,MVC,Silverlight,Windows Forms and WPF. Enjoy developer tools like .NET reporting, ORM,Automated Testing Tools, TFS, and Content Management Solution. And now you can increase your productivity with JustCode, Telerik’s new productivity tool for code analysis and refactoring. Visit www.telerik.com.

As I've said before this show comes to you with the audio expertise and stewardship of Carl Franklin. The name comes from Travis Illig, but the goal of the show is simple. Avoid wasting the listener's time. (and make the commute less boring)

Enjoy. Who knows what'll happen in the next show?

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Programmatically Detecting Screen Readers

March 25, 2010 Comment on this post [4] Posted in Programming | Windows Client
Sponsored By

Tree View

I was installing the RC of Visual Studio 2010 yesterday and while the setup program ran I noticed the words CHECKED and UNCHECKED appearing in the Tree View.

I was thinking I'd found some cool bug, like I was peering into some background world where checkboxes announce their state with text or something. I dunno, it was late, don't judge! ;)

I asked a few people and someone said to to see if I was running a Screen Reader. Screen Readers are what the visually impaired use to find their way around interfaces. It's no at bug at all, it's helping me.

I ran a little program based on this chunk of code found here. I started using the structures found at PInvoke.NET but they were overkill. I didn't need six pages of constants.

[DllImport("user32.dll")]
static extern bool SystemParametersInfo(int iAction, int iParam, out bool bActive, int iUpdate);

public static bool IsScreenReaderActive()
{
int iAction = 70; // SPI_GETSCREENREADER constant;
int iParam = 0;
int iUpdate = 0;
bool bActive = false;
bool bReturn = SystemParametersInfo(iAction, iParam, out bActive, iUpdate);
return bReturn && bActive;
}

static void Main(string[] args)
{
bool retVal = IsScreenReaderActive();
}

Scandalously, the result was true. What? I am running a screen reader? Um, no.

Well, actually, yes. I give lots of presentations, sometimes just to one person looking over my shoulder so I run the Windows 7 Magnifier via the WinKey and PLUS hotkey. When the Windows Magnifier is running, I'm running a Screen Reader in that I'm running an accessibility assistant.

Interesting stuff. I like it when applications are paying attention and helping with accessibility.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Web Deployment Made Awesome: If You're Using XCopy, You're Doing It Wrong

March 24, 2010 Comment on this post [48] Posted in ASP.NET | IIS | Mix | Speaking
Sponsored By

Web Deployment Made Awesome: If You're Using XCopy, You're Doing It Wrong I did three talks at Mix 10 this year, and I'm going to do blog posts for each one, sharing what I talked about and some code if it's useful.

I did a talk on Deployment called "Web Deployment Made Awesome: If You're Using XCopy, You're Doing It Wrong."

You can download the talk here, or watch it online:

VIDEO Download: MP4 Video, Windows Media Video, Windows Media Video (High)

I always try to sneak cooler titles into conferences if I can. It's better than "WEB101: Deploying Websites using Microsoft Visual Studio 2010's WebDeploy OneClick Publish Wizard Super Karate Monkey Death Car September CTP R2." Well, maybe not way better, but still.

imageHere's an outline of what Deployment Related topics I tried to cover

  • Web Packaging - Offline vs. Online
    • From VS 2010
    • From IIS Manager
  • Web.Config Transformation
    • Transform Syntax
    • Locator Syntax
    • Why not XSLT?
  • Deploying
    • Command Line
    • What If Switch
    • From IIS
    • Content Sync
  • DB Deployment
    • Scripting Source DB
    • Adding custom SQL Scripts
  • Download and Deployment of Open Source
    • Web PI
    • App Gallery
  • One Click Publish
    • Using Web Deploy (Ms Deploy) WMSVC
    • Using Web Deploy (Ms Deploy) Remote Agent
    • Using InProc Web Deploy (Ms Deploy)

Here's some cool highlights about WebDeployment in Visual Studio 2010. You can right-click on your web.config and click "Add Config Transforms."

When you do this, you'll get a web.debug.config and a web.release.config. You can make a web.whatever.config if you like, as long as the name lines up with a configuration profile. These files are just the changes you want made, not a complete copy of your web.config.

You might think you'd want to use XSLT to transform a web.config, but while they feels intuitively right it's actually very verbose.

Here's two transforms, one using XSLT and the same one using the XML Document Transform syntax/namespace. As with all things there's multiple ways in XSLT to do this, but you get the general idea. XSLT is a generalized tree transformation language, while this deployment one is optimized for a specific subset of common scenarios. But, the cool part is that each XDT transform is a .NET plugin, so you can make your own.












NewSetting
New Setting Value



Or the same thing via the deployment transform:





Now, to express this concretely, here's my new NerdDinner web.debug.config:










and here's the web.release.config. Note that I update connectionStrings, change appSettings (in this case, Twitter library stuff), and change the system.web section, turning on customErrors and removing the debug attribute.













xdt:Transform="SetAttributes" xdt:Locator="Match(key)" />
xdt:Transform="SetAttributes" xdt:Locator="Match(key)" />




xdt:Transform="Replace">





This is just config transforms, which is a small part of the whole deployment process. I also showed the packaging process and the package deployment that can happen with one-click from within Visual Studio, or can be initiated from IIS, or at the command-line from your Continuous Integration solution.

The WebDeploy packaging and deployment solution is also what the Web Platform Installer uses. It's all the same engine. This screenshot is me importing an open source application directly from a zip file. Note it's more than just what files to use, it's also setting ACLs (Access Control Lists, or permissions) and creating an IIS application. This just scratches the surface.

Deploying DasBlog from IIS using WebDeploy 

Check out my talk, I hope it helps you out. There's more content in that 60 min talk than I could easily put in a single blog post.

Related Links

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Hanselminutes Podcast 206 - Windows Phone 7 Series - The Developer Experience with Charlie Kindel

March 24, 2010 Comment on this post [1] Posted in Podcast | WinPhone
Sponsored By

Windows Phone 7 SeriesMy two-hundred-and-sixth podcast is up. I was at Mix last week in Las Vegas, and got a second to sit down with Charlie Kindel from the Windows Phone team. What's the real developer story? What can these phones do and how do we program them? We talk aesthetic, controls, IDEs and hardware details.

Subscribe: Subscribe to Hanselminutes Subscribe to my Podcast in iTunes

Download: MP3 Full Show

Links from the Show

Do also remember the complete archives are always up and they have PDF Transcripts, a little known feature that show up a few weeks after each show.

I want to add a big thanks to Telerik. Without their support, there wouldn't be a Hanselminutes. I hope they, and you, know that. Someone's gotta pay the bandwidth. Thanks also to Carl Franklin for all his support over these last 4 years!

Telerik is our sponsor for this show.

Building quality software is never easy. It requires skills and imagination. We cannot promise to improve your skills, but when it comes to User Interface and developer tools, we can provide the building blocks to take your application a step closer to your imagination. Explore the leading UI suites for ASP.NET AJAX,MVC,Silverlight, Windows Forms and WPF. Enjoy developer tools like .NET reporting, ORM,Automated Testing Tools, TFS, and Content Management Solution. And now you can increase your productivity with JustCode, Telerik’s new productivity tool for code analysis and refactoring. Visit www.telerik.com.

As I've said before this show comes to you with the audio expertise and stewardship of Carl Franklin. The name comes from Travis Illig, but the goal of the show is simple. Avoid wasting the listener's time. (and make the commute less boring)

Enjoy. Who knows what'll happen in the next show?

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.