.NET User Group event on Thu, Jun 4: Code Contracts, Pex, and CHESS

Twin Cities .Net User Group is hosting a presentation on Code Contracts, Pex, and CHESS.

What: Maintaining Resilient Code: Using Tools From Microsoft's DevLabs and Research
Who: Jason Bock
When: Thursday, June 4, 5:00pm-7:00pm.
Where: Microsoft Corporation, 8300 Norman Center Drive, Suite 950, Bloomington MN 55437
Cost: Free

See http://www.ilmservice.com/twincitiesnet/seminar.aspx for more information. I plan on attending. See you there!

Looking back at Microsoft TechEd 2009

I just came back from Microsoft TechEd 2009 conference in Los Angeles. This year's conference was smaller than usual registering only about 7,000 attendees. If you did not get a chance to attend, take a look at the highlights below.

Azure

Windows Azure is a run-time environment in the cloud that provides an ability to host, seamlessly scale, and manage web applications and services. I was amazed by how many sessions this year were dedicated to Windows Azure as well as Azure Services Platform which includes .NET Services, SQL Data Services, and Live Services. Although the detailed pricing and service-level agreements have not been announced, it is clear that Microsoft is seriously investing into their cloud infrastructure with the intention to offer .NET developers a choice to host web applications on-premise, externally, or in the cloud.

Silverlight

Microsoft Silverlight is a web browser plug-in for delivering Rich Internet Applications (RIA). I attended a day-long seminar on Silverlight led by Jeff Prosise. Jeff took a deep dive into capabilities of Silverlight 2 and 3 and explained the logic and philosophy behind many Silverlight design decisions. This was one of my favourite TechEd sessions this year.

Over the last couple of years, Silverlight has matured into a very powerful product. We have observed significant decreases in project cycle times when building RIA applications using Silverlight 2 as opposed to AJAX and JavaScript toolkits. Silverlight 3 introduces many new long-awaited features, such as back-button navigation, deep linking, dynamic styling, style inheritance, element-to-element binding, writable bitmaps, offline support, etc.

Note that according to http://riastats.com/ as of May 19, 2009, Silverlight 2/3 is installed only on 27% of client computers. While not a concern for an Intranet application, it presents a challenge when you have no control over your client environments.

ASP.NET 4.0

Surprisingly, ASP.NET core classes have not changed much, which is an excellent news for your existing web infrastructure. Our security, logging, exception management, content management, branding, internationalization, and other infrastructural libraries are likely to integrate seamlessly with the new version of ASP.NET.

The features that make me excited about the upcoming release of ASP.NET 4.0 are integration of ASP.NET with jQuery and availability of client-side templates and data binding. Take a look at ASP.NET AJAX 4.0 Preview 4 on codeplex.com to get a better idea on what is coming out.

Hyper-V

Microsoft Hyper-V is a virtualization platform that ships with Windows Server 2008 for x64. It allows you to optimize your server hardware by consolidating multiple servers into a single physical machine running multiple virtual machines. Virtualization was a very hot topic at the conference.

Windows Server 2008 R2 and Windows 7

Quite a few sessions as well as the key note were dedicated to the upcoming releases of Windows Server 2008 R2 and Windows 7. Both products are on schedule to be released at the end of this year.

Miscellaneous

A few additional sessions are well worth mentioning:

  1. "The Scaling Habits of ASP.NET Applications", an excellent talk on scalability of ASP.NET by Kent Alstad, CTO of StrangeLoop Networks.
  2. "Cracking Open Kerberos: How Active Directory Knows Who You Are" by Mark Minasi, Chief Scientist at MR&D. Mark's presentation helped me better understand how Kerberos tickets work as well as when and why Kerberos switches to NTLM.
  3. "Busy Microsoft .NET Developer's Guide to F#" by Ted Neward. I am contemplating using F# for one of our financial calculators.

iBatis.NET DataMapper 1.6.1 does not support default parameters in stored procedures

iBatis.Net DataMapper is our de facto standard for implementing persistence in .NET applications. The framework works well with an object-oriented domain model and relational data store.

Today, we stumbled upon a bug in the latest production release of iBatis.Net DataMapper. A new parameter was added to the existing stored procedure and although this parameter came with a default value, the application threw the following exception: 
"Specified argument was out of the range of valid values. Parameter name: index" from IBatisNet.DataMapper.Configuration.ParameterMapping.ParameterPropertyCollection.get_Item.

One way to work around this issue is to replace the original procedure configuration:

<statements>
  <procedure id="OurStoredProcedure" parameterMap="OurStoredProcedure_Parameters" >
    up_YourStoredProcedure
  </procedure>
</statements>

</parameterMaps> 
   <parameterMap id="OurStoredProcedure_Parameters" class="OurParametersClass">
     <parameter property="Value1"/>
     <parameter property="Value2"/>
   </parameterMap>
<parameterMaps>

with a dynamic statement:

<statements>
  <statement id="OurStoredProcedure" parameterClass="OurParametersClass" >
    EXEC up_OurStoredProcedure #Value1#, #Value2#
  </statement>
</statements>

Happy coding!

FDF Toolkit 6, SSL, ASP.NET 2.0 Handler, and Internet Explorer cannot display the webpage

We run into an interesting problem today while working with FDF Toolkit 6 inside ASP.NET 2.0 HttpHandler. Internet Explorer 7 refused to open a pre-populated PDF form produced by the handler when communicating with the server over SSL.

We could see data coming to the client and AcroRd32.exe starting... however the browser continued to display "Internet Explorer cannot display the webpage" message. The same code worked well in IE without SSL or in FireFox with or without SSL.

The problem was related to caching. For some reason, any of the lines below cause IE not to be able to open an FDF form:

context.Response.CacheControl = "no-cache";
context.Response.AddHeader("pragma", "no-cache");
context.Response.Cache.SetCacheability(HttpCacheability.NoCache);

Removing these lines fixed the problem. Happy coding!

ReSharper 4.0 is finally released

It is finally here. The long waited ReSharper 4.0 has been released: http://www.jetbrains.com/resharper/.

Since we moved our .NET development to Visual Studio 2008 and .NET 3.5 at the end of last year, we have been using daily builds and betas of ReSharper 4.0. I am happy to see our favourite C# productivity tool released! 

JavaScript tags cannot be self-closing

I was puzzled today by the following exception coming out of one of our web application: this._form has no properties. The exception occurred even on simple pages that had a form and a Script Manager tag. After troubleshooting the issue, I traced it down to the script tag on the site master page. Apparently, JavaScript tags cannot be self-closing.  

Replacing 

             <script language="javascript" type="text/javascript" src="my.js"/> 

with  

             <script language="javascript" type="text/javascript" src="my.js"></script>  

resolved the issue. Happy coding!

.NET 3.5, WCF, JSON, SSL, and HTTP Error Code 401

We run into an interesting problem today at work while working with JSON WCF Web Services built with Visual Studio 2008 and .NET 3.5.

The web application we are working on is to be released in a couple of weeks. It has been running fine on the test server for a number of iterations now, but today we installed an SSL certificate on this server and configured the application to require secure channel. Suddenly, the web application started to ask us for a username and password...

I looked closer into the logs and noticed the HTTP Error Code 401 (authorization error) coming back from web services when the web application requested our java script proxies. It turns out that in order to allow communication with the services via SSL, you need to configure additional binding configuration. See below our sample service model configuration. Hope it will save you a few hours of troubleshooting. 

<system.serviceModel>
    <behaviors
>
        <endpointBehaviors>
            <
behavior name="jsonBehavior">
                <enableWebScript />
            </
behavior>
        </endpointBehaviors>  

        <
serviceBehaviors>
            <behavior name="myServiceBehavior"
>
                <
serviceMetadata httpGetEnabled="true" httpGetUrl="" />  
                <serviceDebug includeExceptionDetailInFaults="true"
/>
                <serviceThrottling maxConcurrentCalls="100"
                                          maxConcurrentInstances="1000"
                                          maxConcurrentSessions="1000"/>
 
            </behavior
>
        </
serviceBehaviors> 
    </behaviors
>  

    <
bindings> 
        <webHttpBinding
>
            <
binding name="sslBinding"> 
                <security mode="Transport"
/>
            </
binding>
        </webHttpBinding> 
    </
bindings>  

    <serviceHostingEnvironment aspNetCompatibilityEnabled="true"
/>
        <
services> 
            <service behaviorConfiguration="myServiceBehavior"
 
                        name="CourseCatalog"

            
<endpoint contract="CourseCatalog"
                               address=""
                               behaviorConfiguration="jsonBehavior"
                               binding="webHttpBinding"
                               bindingConfiguration="sslBinding"/>
 
                <endpoint contract="IMetadataExchange
                               address="mex
                               binding="mexHttpBinding" />
  
            </service>
 
    </services

</system.serviceModel>

Happy coding!

Welcome to ModelBlog

Thank you for visiting ModelBlog. We hope the time you spend with us will be both entertaining and worth your while. Have fun!

Authors

Search

Archive

Tags