Orchard 1.3 is Released!

by Arra Derderian 4. October 2011 17:05

 

 

Orchard 1.3 fixes bugs, improves performance and introduces the following features:

  •  Content item preview
  • Markdown support
  • Delete content types and parts
  • Title part enables non-routable types to have a title
  • Common added by default to content types
  • Rules: trigger custom actions triggered by events
  • Forms API: create forms from code
  • Tokens: system-wide variables
  • New content manager methods: part eager loading, get multiple items by ids in one query
  • Task Lease API: creates server affinities for background tasks on web farms and cloud platforms
  • Localization: data annotations, widgets, alternates
  • Lists have RSS feeds


The full list of fixed bugs for this release can be found here: 


Orchard Items

 

 

Tags: ,

ASP.NET | Azure | Cloud Computing | Engineering | Technology | orchard cms

Application Dynamic Environment Configuration for .NET Apps and Windows Azure Service Roles

by Arra Derderian 30. September 2011 19:57

azure

 

When creating websites and applications it is one thing to make your application work in your development environment but it is another thing to make it work in the many integration environments that it will live in. An example, of this is a website that is developed locally, integration tested on a development box, tested in a QA environment, reviewed by a client in a staging environment, and pushed live to a production environment. 

All of these configurations require different database connection strings, email server addresses, and local file system locations for uploaded files. On top of these dynamic environment settings includes a Version Control system that most all of us use in our everyday life. I am sure everyone has accidentally checked in a web.config file that has a development connection string and it has caused problems in production. Secondly, it is a pain to manage these files in multiple environments by having to edit them on each server. Newer version of .NET have released the concept of the web.config.debug and web.config.release versions to mitigate this problem a bit but it really does not solve the problem for more than two environments.

Lastly, with the ability to write applications for the Windows Azure platform we want our applications to be easily tested locally and deployed to the cloud seamlessly. I want to be able to test my application locally on perhaps a local SQL database, but then when in the Cloud it should be connecting to a SQL Azure datasource and utilizing blob storage instead of file storage.

Cloud Construct has been using the concept of a dynamic configuration file for applications since we started writing web applications and standalone apps as well. The general concept is an XML driven file that contains settings that can be set for multiple environments that use an "endpoint" to resolve at application start the environment the application is running in. For example, in a web application project we will add some code to initialize our static Configuration class. The Configuration class will resolve the environment based on server endpoint and apply its settings to the object's properties. We can then access these properties from any place in our code.

Endpoints are resolved by server name and settings are pulled in the following order: 1. Global Settings 2. Environment Settings 3. Endpoint Settings. This allows global items to be applied to all environments when needed. Then environment specific settings will be applied. Lastly, any machine settings. Here is an example of this file:

config.xml (3.47 kb)

As you can see we have 3 specific environments:

1. Production, a single "Cloud" endpoint which resolves for the wildcard hostnames given in the cloud.

2. Staging, a single server endpoint.

3. Development, my local development machine endpoint and also my machine when it is in the local "Cloud" debugging mode. (It resolves Cloud endpoints over normal endpoints by checking to see if: RoleEnvironment.IsAvailable ? "cloud_endpoint" : "endpoint"

Each of these environments can have multiple endpoints as you can see so that if you have multiple servers in production they can all be resolved to that environment and possibly have their own settings on that machine. This file can be checked in easily to version control without causing problems in other environments accidentally and also limits all settings to a single file. Also I can take my applications and develop them in a way that in the future if clients want to expand to the cloud they can easily do so by just adding a cloud endpoint with its settings. For example, the EmailServer that uses SendGrid in the cloud or a local one when in staging:

if (CloudConstructConfig.Environment.IsInCloud)
{
System.Net.NetworkCredential credentials = 
    new System.Net.NetworkCredential(CloudConstructConfig.EmailUsername, 
   CloudConstructConfig.EmailPassword);

smtpClient.Credentials = credentials;
}

 

Above we are simply adding an extra credential when we are in the cloud to send emails. Otherwise the code is the same!

Sooo I am sure you want to know how do I get this code and integrate it right? Well here is the library: 

CloudConstructWebConfigurator_V1.0.zip (305.98 kb)

In order to integrate it into your application you can do the following:

1. Add a reference to CloudConstructWebConfigurator.dll in your project. (You can also add a reference to log4net dll as well for logging integration if you already are using it.)

2. Add a static class to your project that holds all of the settings configured in your XML file. This is the object you reference in code for your settings. (See the ClassLibrary1 project in the example integration zip below.)

3. Wire up your code in your global.asax.cs file to run on application startup and instantiate your static class.

4. Copy the Config directory into the App_Data directory.

Here is the link to the zip file of the example project utilizing the dynamic configuration library:

WebApplication1.zip (157.22 kb)

Important files to look at are the global.asax.cs, ClassLibrary1.CloudConstructConfig, and config.xml which drives the settings.

NOTE: It may be necessary to also add a reference to Microsoft.WindowsAzure.ServiceRuntime.dll if it does not exist on your system. It is provided with the zip file.

LOGGING INFORMATION:

If you utilize log4net you will get some great startup logging information:

 

2011-10-01 09:55:08,995 INFO  - *********************************

2011-10-01 09:55:09,005 INFO  -  Starting My WebApp

2011-10-01 09:55:09,005 INFO  - *********************************

2011-10-01 09:55:09,163 INFO  - Found host name to be: ARRA-CLOUD-PC.

2011-10-01 09:55:09,164 INFO  - Found 5 required items in the configuration file.

2011-10-01 09:55:09,164 INFO  - Found a global item list in the configuration file.

2011-10-01 09:55:09,167 INFO  - Processed Global file item: ContactEmailTemplate

2011-10-01 09:55:09,167 INFO  - Processed Global configuration item: EmailClientFooter

2011-10-01 09:55:09,168 INFO  - Processed Global flag item: DoCacheProfiles

2011-10-01 09:55:09,349 INFO  - Recognized environment as development, executing in normal context

2011-10-01 09:55:09,349 INFO  - Processed Environment database item: PrimaryDB

2011-10-01 09:55:09,349 INFO  - Processed Environment configuration item: EmailServer

2011-10-01 09:55:09,349 INFO  - Updated to Environment flag item: DoCacheProfiles

2011-10-01 09:55:09,349 INFO  - Matched host as ARRA-CLOUD-PC

2011-10-01 09:55:09,350 INFO  - Loaded 5 out of 5 required items.

2011-10-01 09:55:09,350 INFO  - No errors found when validating all configuration items.

2011-10-01 09:55:09,351 INFO  - Completed loading configuration file.

Return valid XML markup in a WCF service based on an XSD.

by Arra Derderian 10. September 2011 18:53

Have you ever had to produce a WCF service or POX webservice that returns valid markup based on a third party schema? Well I have. There is alot of industry standards out there for data transfer and integration. Chances are you may have to support communicating within these means via a webservice. Well as long as you can get your hands on an XSD document for the XML you need to generate Visual Studio makes it easy for you to do this. XSD.exe is a tool that comes with Visual Studio and it allows you to auto generate class files based on your XSD document. 

For example, you have a set of data that stored in your database that you need to communicate with an outside party and you both agree to use a common standard of XML for communication. (Maybe you are in mutual fund trading and there is a standard out there for fund transfer, or the other company has an existing schema they would like you to use.) If there is and XSD document provided by the governing body of that protocol or the company you can simply run "xsd.exe file.xm"l from the command line and you got your application layer for you webservice. Simply drop those class files into your solution and make a database call to populate the objects and return it via your webservice call. 

I like this method over supporting WSDL for services because it is safer from my point of view. No need to publicly expose any internal information and only the parties with the XSD.exe document know how to communicate. The methods and locations of the service are hidden from the end party as well.

Tags: , ,

ASP.NET | Engineering | Technology

Azure Series Part 3: Migrating Http Modules and Handlers to Windows Azure

by Arra Derderian 10. July 2011 20:17

For some legacy ASP.NET sites you may notice your old HTTP Handlers and Modules being configured in the web.config <system.web> section do not work anymore in the Windows Azure. This is because Windows Azure is configured to run on IIS in "Integrated Pipeline" mode. This means web requests are integrated into IIS as opposed to classic pipeline mode where requests go only through the isapi.dll. In Integrated Pipeline mode your <httModules> and <httpHandlers> nodes will throw an invalid configuration exception.

I struggled to find out why this was happening and then I realized Azure was host in IIS 7 with Integrated Pipeline setup. You now define your modules and handlers in your <system.webserver> section of the web.config. This is helpful because now my "Browser Support Module" can be reused in the cloud. I have a specific module to redirect requests from browsers that are not supported by my website.

 

Tags: , ,

ASP.NET | Azure | Cloud Computing | Engineering

Debugger Canvas PowerTool for Visual Studio

by Arra Derderian 14. June 2011 23:10

A colleague of mine just sent me a link about a new power tool for Visual Studio called Debugger Canvas. The debugger canvas is a cool new way to visualize debugging outside of the normal file view. It allows you to easily navigate files and compare the source code side-by-side for each file involved in your debugging.

Other features included, saving an XPS file with notes to send other engineers information on the fix. Also you can utilize the Intellitrace feature to easily find pieces of code and search them for possible areas where code may be broken.

There is a short video you can watch here:

Thanks to @Jere_Jones for the information.

Tags: , , ,

ASP.NET | Engineering | Technology

Windows Phone 7 Mango release to include SQL Compact Edition

by Arra Derderian 12. May 2011 07:21

I attended the Windows Phone 7 Garage on Monday and heard one new feature that was coming out with the Mango release was SQL CE. LINQ queries will also be supported making the time to get an app up and running MUCH faster. After using SQL CE with Orchard CMS it is amazing how easy it is to use and manage. It is lightweight, very functional, and FREE. As a note make sure you install Visual Studio 2010 SP1 so you can manage your SQL CE database from Visual Studio Server Explorer!! You can't explore the database without SP1.

I am excited for Mango because it will expand the functionality of the Windows Phone Control library so developers can access more features of the phone like contacts, calendar, and the motion sensor. Also it will have Internet Explorer 9 as well. Unfourtunately, it will not have the ability to access the network interface and query wifi information. This is something I think needs to be added to compete with iPhone and Android developer libraries.

I can't wait for the release...but am not sure when it is coming. I keep hearing conflicting dates.

Tags:

ASP.NET | Engineering

Send emails from Windows Azure with SendGrid

by Arra Derderian 24. April 2011 18:51
After moving our website to Windows Azure we had one problem. Well we had a couple, but all of them were resolved pretty simply. The one that lingered was that our Contact Form stopped working. This is because there is no email server used for relay in Azure. Microsoft does this so people cannot send out millions of spam emails from Azure. Needless to say this made it hard to get a simple contact form working. We did not want to expose our hosting server email server to the outside ourselves because we could not verify our Azure server IP would be the same all the time. After searching for some solutions out there the best option seemed to be to use a third party email service like Amazon, SendGrid, or Postmark. Being a small business we knew we didn't want to pay anything to just have our contact form send one or two emails a month. The lowest plan I could find was $9.95/month from SendGrid. This was still too much. I then scrolled to the bottom of the pricing page and found a FREE option! Just scroll to the bottom of the page:


Once I signed up for the free plan it took a few hours for my account to be provisioned. Once that was done I was able to integrate my existing C# code which looked very much like this, C# SMTP example. You can also use the REST protocol but this is much cleaner in my mind. I tried testing the code from my dev environment but I kept getting an error saying the server could not be reached. I then thought maybe I can only access the email server from behind the URL I registered. So I pushed the code to Azure and gave it a whirl. It worked! Voila an email solution that lets you send 200 emails a day for free, and it works from Azure. Hopefully our contact form gets some activity in the coming months!

Tags:

ASP.NET | Azure | Cloud Computing | Engineering | Technology

BizSpark Helps Startups with Azure Small Compute and Software

by Arra Derderian 31. March 2011 20:03

Tonight I will be giving a brief talk at the Boston Azure Group meeting about the benefits of Microsoft BizSpark for start-up companies. Cloud Construct used BizSpark to host our website in Windows Azure with a SQL Azure backend. All of the software and resources came free with our entrance into BizSpark.

 

 

Here is a link to the presentation if you want to take a look: BizSpark Azure Benefits Presentation

 

Here is a link to the Azure Benefits page.

Tags:

ASP.NET | Cloud Computing | Engineering | SEO & Online Marketing | Technology

Azure Series Part 2 : Obtaining Hosting in the Azure Cloud

by Arra Derderian 28. January 2011 06:46

After you have completed your first Windows Azure website or migrated an existing site to a webrole/website architecture you are probably wondering  "How Can I Get This Too The Real Cloud?". Well Microsoft does offer some Free Trial hosting but it is only for a month. If you have an MSDN license already you can gain access to some hosting resources for free which is great, but most of us don't have this because it is expensive. If you are a BizSpark member you get an MSDN license for free and thus can gain access to the Azure resources.

I took the road of signing up for BizSpark and it was very easy. BizSpark is free except that if you ever leave the BizSpark network you have to pay $100.00. If your company is privately held and less than three years old you are good to go.

Once you secure the BizSpark affiliation you can easily gain access to the MSDN license and thus the Azure hosting tools. Once all that is done you can deploy your new website to Windows Azure.

See the BizSpark benefits here.

 

Tags:

ASP.NET | Azure | Cloud Computing | Engineering

Azure Series Part 1 : Migrating your Existing Site to a Windows Azure Web Role

by Arra Derderian 24. January 2011 00:32

With the emergence of Windows Azure, Cloud Construct has decided to migrate its existing site to a web role to run in the Azure cloud. We will be utilizing a hosted service, App Storage, and SQL Azure. Our existing site runs as a .NET 4.0 just-in-time compiled website, hosted on IIS, and with a SQL backend. This post will deal with migrating the existing .NET 4.0 site to run in the Azure service host environment, following posts will deal with connecting to SQL Azure.

  • Step 1 : Create a new cloud service project.

  • Step 2 : Assign a web role project to the Cloud Service solution.

You will notice that a new Windows Azure Cloud Service project will be added to your new solution. Secondly. a Web Role project will be added which is similar to a web application project but includes a WebRole.cs file which defines the web role entry point. This WebRole application will be assigned to your cloud service project and will be started up when your service starts up. The WebRole project will be included with some default files such as a Scripts directory and some basic .NET web pages. I deleted all of these boilerplate resources so  could begin porting my site into this project.

  • Step 3 : Port over your existing site content.

Right now the easiest way to migrate your site into the project is to simply copy all the files over. Do not overwrite the web.config file! Any settings you had in there prior you can then cut-n-paste them into the WebRole project web.config. After you have copied all your files over, there are a few steps you will have to perform. If you are coming from a web application project then you will not have to perform these next step two steps.

  • Step 3a : Convert all website files to web application files.

Because the WebRole project is technically a web application project you must convert your just-in-time compiled web pages to web application pages. This basically means adding a *designer.cs file to every page. The easiest way to do this is right click on the project in solution explorer and choose "Convert to Web Application". This will add designer files to all web page files.
  • Step 3b : Migrate your App_Code directory to a class library

Because a web application project does not include an App_Code directory you must move all class files to a separate class library project. You will end up with multiple assembly conflicts if you do not which will cause a whole bunch of other problems.
  • Step 4 : Rebuild and start your new cloud service.

Now that you have all your content ported over you can rebuild your new solution and make sure everything is all good. Lastly, start debugging the project and make sure your website runs in the local dev environment. If it all comes up the first time then your in luck. You might have to tweak some other portions of your site to make sure it all works but for the most part this should get you there. One snag I hit was documents being served out of the site like PDF's will require you to set their build action to "Content" instead of "None". This will make sure the file gets packaged and deployed with your cloud service.

Tags:

ASP.NET | Cloud Computing | Engineering | Technology