Jeff Widmer's Blog

ASP.NET, ASP.NET MVC, C#, VB.NET, IIS7, Windows Forms, VB6, ASP 3.0

  • Visual Studio confused when there are multiple system.web sections in your web.config

    I am trying to start debugging in Visual Studio for the website I am currently working on but Visual Studio is telling me that I have to enable debugging in the web.config to continue:

    image

    But I clearly have debugging enabled:

    image

    At first I chose the option to Modify the Web.config file to enable debugging but then I started receiving the following exception on my site:

    HTTP Error 500.19 - Internal Server Error

    The requested page cannot be accessed because the related configuration data for the page is invalid.

    Config section 'system.web/compilation' already defined. Sections must only appear once per config file. See the help topic <location> for exceptions

     

    So what is going on here?  I already have debug=”true”, Visual Studio tells me I do not, and then when I give Visual Studio permission to fix the problem, I get a configuration error.

    Eventually I tracked it down to having two <system.web> sections.

    I had defined customErrors higher in the web.config:

    image

    And then had a second system.web section with compilation debug=”true” further down in the web.config.  This is valid in the web.config and my site was not complaining but I guess Visual Studio does not know how to handle it and sees the first system.web, does not see the debug=”true” and thinks your site is not set up for debugging.

    To fix this so that Visual Studio was not going to complain, I removed the duplicate system.web declaration and moved the customErrors statement down.

  • Configuring SharePoint Foundation 2010 for SharePoint Workspace 2010

    SharePoint Workspace 2010 is the new version of Groove that will give you an offline copy of a SharePoint website and also allow you to work with a SharePoint site outside of a browser.  SharePoint Workspace 2010 is especially nice for editing documents in a SharePoint Document library.  SharePoint Workspace makes the SharePoint Document Library work just like a folder on your computer and will handle the synchronization of the documents back to the SharePoint server for you.

    If you try connecting SharePoint Workspace 2010 to a default SharePoint Foundation 2010 installation you may get an error like this one:

    ---------------------------
    Sync to SharePoint Workspace
    ---------------------------
    SharePoint Workspace was unable to interpret the SharePoint location. Please check and ensure the location contains no typing errors.
    ---------------------------
    OK Help
    ---------------------------

    This is because the default configuration of SharePoint Foundation 2010 requires two configuration changes to allow SharePoint Workspace 2010 to work.

    The first is to enable the Remote Differential Compression feature on the server that is hosting SharePoint.  This is used by SharePoint Workspace 2010 to send and receive the files for synchronization.

    To enable Remote Differential Compression go to the Server Manager > Features and choose Add Features.

    image

    Check the box for the Remote Differential Compression feature and then click Install to enable this feature.

    image

     

    The second configuration change to allow SharePoint Workspace 2010 to work with your SharePoint Foundation 2010 server is to add an Alternate Access Mapping of the public facing DNS name (or IP address) to SharePoint using the SharePoint Central Admin.  If you are connecting to your SharePoint site using the machine name then this is not necessary, but if you are connecting over the Internet through either an IP address or DNS name then you will need to add this alternate access mapping.

    The reason is that when SharePoint is first installed, the only way it thinks users are connecting to the server is through the machine name: http://machine_name (as if on a local intranet).  Since most likely SharePoint Workspace 2010 users will be connecting through a public facing DNS name (or IP address), you will need to add this DNS name (or IP address) as an alternate access mapping (indicating that this DNS name is the same as the machine_name and should map to the SharePoint site).

    To add an Alternate Access Mapping to SharePoint Foundation 2010, visit the SharePoint Central Administration on the SharePoint Foundation 2010 server:

    image

    Once in the SharePoint Central Administration website, click on the Application Management link

    image

    Then under the Web Applications heading choose Configure alternate access mappings

    image

    Choose Edit Public URLs

    image

    And then select the public facing SharePoint website that you want to add an access mapping to.  You do this by changing the Alternate Access Mapping Collection (clicking on the “No selection” drop down button) to the website that is running on Port 80.

    image

    The  default name of the public facing SharePoint site is “SharePoint – 80” but you may have changed that when you configured your SharePoint site.

    image

    Once you have switched the Alternate Access Mapping Collection to the public SharePoint website (SharePoint – 80) then you can specify the Public URL by adding the publically accessible IP Address or DNS name to the Internet field:

    image

    image

    Click Save to apply the alternate access mapping and now you should be able to connect to your SharePoint Foundation 2010 site with SharePoint Workspace 2010:

    image

    clip_image001

     

    SharePoint Foundation 2010 is the free version of SharePoint that installs on top of Windows Server 2008.  With SharePoint Workspace 2010 you can get an offline copy of your SharePoint team site allowing you to add/edit your documents in any SharePoint document library easily and allow SharePoint Workspace 2010 to handle the file synchronization for you. 

    You can take a look at SharePoint Foundation 2010 quickly and easily by starting a preconfigured SharePoint Foundation 2010 Virtual Machine at Vaasnet.com.  Vaasnet.com is a new Internet startup that provides preconfigured virtual machines (such as a virtual machine with SharePoint Foundation 2010 already installed) that are ready for you to start and begin using right away.  Vaasnet.com takes the hassle out of downloading and installing the Windows Server 2008 operating system and SharePoint Foundation 2010 so that you can quickly log in and begin trying out the new features of SharePoint Foundation 2010.

  • How to view Outlook 2010 Internet headers for an email

    In Outlook 2010 getting to the Internet headers for an email has been moved to the File Menu for a particular email message. 

    In Outlook 2007 (and previous versions) you used to be able to view the internet headers of an email message by right-clicking on any email message and choosing the “Options” menu option from the context menu that appeared.  In Outlook 2010 this has moved to the File menu.

    To get to the Internet Headers of an email in Outlook 2010:

    Open the email message in its own window (by double clicking on the message).

    Then go to File > Info for that message:

    image

    And then in the right-hand pane click on the Properties button

    image

    This will bring up the Properties dialog with the Internet headers located at the bottom:

    image

  • Windows 7 User Account Control does not allow drag and drop

    I recently upgraded my laptop to Windows 7 and my development desktop to Windows Server 2008 R2.  While I was setting up my development environment, I ran into an issue where drag and drop in Component Services would not work on either machine.  Normally I would just create my COM+ Application and then drag the DLLs into the components folder to have them registered, but this was not working on either machine.

    I then tried to run some setup SQL scripts by dragging the .sql files into SQL Server Management Studio.  Again nothing happened when I dragged the file over SQL Server Management Studio and let go of my mouse button.

    Eventually I was able to track it down to User Account Control (UAC).  I had decided to try and leave User Account Control enabled on both of these machines and up to this point I had not had many problems and everything was working as expected.  But after turning User Account Control off (and rebooting), I was able to drag and drop in Component Services and SQL Server Management Studio again.

    To be honest, with Windows Vista and Windows Server 2008, I immediately turned off User Access Control since it was too interfering, so I am not sure if drag and drop in these applications is a problem too.  With Windows 7 and Windows Server 2008 R2 I was going to give UAC a try and leave it enabled.  Maybe there is another way to enable drag and drop in these applications and still have User Account Control enabled, but at this point I have not been able to find it.

    image

     

    UPDATE (2010-06-21): Eric Murriguez found the solution to this problem of Windows 7 User Account Control not allowing drag and drop.  There is a Local Security Policy called User Account Control: Run all administrators in Admin Approval Mode which controls this.  Setting this to “Disabled” effectively means that Admin Approval Mode is no longer required for members of the local Administrators group… effectively disabling UAC entirely for those users.  Which is about the same as turning off UAC entirely but still this setting allows you to control it just for administrators.  The setting is found under: Security Settings > Local Policies > Security Options.

  • Cannot connect to SQL Azure Database

    When connecting to a SQL Azure Database using SQL Server Enterprise Manager you will get a “Cannot connect” error if you have not configured the SQL Azure firewall to let your IP address through.

    image

    To configure the firewall, log into the Windows Azure portal at http://windows.azure.com and then select the SQL Azure tab on the left navigation:

    image

    And then choose the project you are connecting to.  This will bring you to the Server Administration panel where you can select the Firewall Settings tab.

    image

    Click the Add Rule button to add your IP address (or range) into the SQL Azure Firewall.  A couple of minutes later you should be able to connect to your SQL Server Instance.

    ______________________________________________________________________

    TITLE: Connect to Server
    ------------------------------
    Cannot connect to XXXXXXX.database.windows.net.
    ------------------------------
    ADDITIONAL INFORMATION:
    Cannot open server 'XXXXXXX' requested by the login. Client with IP address 'XXX.XXX.XXX.XXX' is not allowed to access the server.  To enable access, use the SQL Azure Portal or run sp_set_firewall_rule on the master database to create a firewall rule for this IP address or address range.  It may take up to five minutes for this change to take effect.
    Login failed for user 'XXXXXXX'. (Microsoft SQL Server, Error: 40615)
    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=40615&LinkId=20476



  • Screenpresso image editing not working after Windows 7 upgrade

    I upgraded my computer to Windows 7 and now my Screenpresso image editor is not working.  After grabbing a screen capture I get an error dialog with just a path and the caption “UpdateToobarButton” (yes, there is a typo; Toobar instead of Toolbar):

    image

    And then the image editing buttons in the history panel are grayed out:

    image

    I browsed to the “C:\Program Files\Windows Photo Gallery” folder but it was empty which probably explains the error (most likely File Not Found).

    I did find the PhotoViewer.dll at “C:\Program Files\Windows Photo Viewer\PhotoViewer.dll”.  Copying this file to “C:\Program Files\Windows Photo Gallery\PhotoViewer.dll” resolved the issue for me.  

    ---------------------------
    UpdateToobarButton
    ---------------------------
    C:\Program Files\Windows Photo Gallery\PhotoViewer.dll
    ---------------------------
    OK  
    ---------------------------



  • Getting Started with Windows Azure: Part 2 - Creating a Windows Azure Hello World Application

    Follow along as I learn all about Windows Azure.

    Part 0 – Where do I go to get started?
    Part 1 - Setting up your development environment
    Part 2 - Creating a Windows Azure Hello World Application <<<< YOU ARE HERE

    Below are the steps to create a simple Windows Azure Hello World application.  These steps assume that you have installed the Windows Azure Tools for Visual Studio.  See Part 1 - Setting up your development environment for more information on setting up your development environment.

    Open Visual Studio 2008 and choose New Project.  Then expand the language of your choice and click on the “Cloud” category to find the Windows Azure Cloud Service project type.

    image

     

    Select the Windows Azure Cloud Service project type and then you will be presented with the Role selection dialog.  Choose the ASP.NET Web Role and move it to the right-hand frame.  You can edit the name of the role by clicking on the edit (pencil) icon for that role.

    image

     

    You will then have Visual Studio projects like the following:

    image

    Modify the Default.aspx page to include your “Hello World” text or anything else you would like and then hit F5 to test.

    After Windows Azure finishes initializing the Development Storage, you will be presented with your Hello World page running on your local machine:

    image 

    At this point you are ready to deploy to the cloud but first you need to sign up for the service.  I will move on with how to sign up and create the Windows Azure Portal Account and then come back to publishing and deploying your Hello World project later….

    Signing up for the Windows Azure Service

    Next up is to sign up for the Windows Azure Service through Microsoft Online Services.  Signing up for a Windows Azure account can be a little confusing since you don’t sign up for Windows Azure directly but sign up with Microsoft Online Services which manages all of your subscriptions to the Microsoft Online Services (Azure is one of them; there also is the hosted Exchange and SharePoint which you can sign up for too).

    You can see the various Windows Azure offers from this page and here is a Windows Azure Comparison chart which shows that there is a free offer called “Introductory Special”.  The Introductory Special offer says it lasts only until July so I guess at that point Microsoft Online Services will start charging your credit card for any services that are in use.

    WARNING: The introductory offer only includes 25 hours of compute time.  You can easily burn through that by just leaving your deployment running (faster if you have both a staging and production deployment running).  Make sure you DELETE (not suspend; you must DELETE) your hosted service deployment (see below) when you have finished with this tutorial.

    image

    Clicking on the Buy button takes me to the Microsoft Online Services customer portal where you can sign in with your Windows Live account and sign up for the Windows Azure Service.  NOTE: Signing up on the Microsoft Online Services site is a multi-step process where you first create your account, then checkout with the Windows Azure Introductory Special in your shopping cart, activate your service, and finally specify the service administrator. 

    Here is the Service Activation Screen where I have specified the project name as “AzureHelloWorld”.  This project name will be the project that is created in the Windows Azure Portal later on (what’s up with those purple borders around everything?!?).

    image

    Now you will have a subscription to Windows Azure and after a little bit the Microsoft Online Services Customer Portal will show that the Service is Active:

    image

    Now you can go to the Windows Azure Portal (http://windows.azure.com) and sign in with the same Windows Live account that you used to sign up for the subscription at Microsoft Online Services.

    Now you will see the Windows Azure Portal home page with a single project named from when you activated the service (in my case, AzureHelloWorld).

    image

    Select this project and choose New Service which is located to the right and just above the project name:image

    Choose the Hosted Services from the two Windows Azure services that are presented:

    image

    Then name the service:

    image 

    Then choose a url for your service and also the region where it will be running:

    image

    Clicking Next will get you to the Deployment page:

    image

    Now you are at the point where you can deploy your Hello World project that you created earlier, but first you have to use Visual Studio to Publish it.

    Return to your Hello World Visual Studio Windows Azure project and right click on the HelloWorld Azure Project and click “Publish…”:

    image

    This will create the deployment package and the configuration package (and open Windows Explorer to their location too):

    image

    A new browser will be opened and you will be taken to the Windows Azure Portal but you can close that and return to the previous window where the Deploy cube was showing:

    image

    Click that “Deploy…” button and browse to the application package (*.cspkg) and configuration settings (*.cscfg) and then give a name for this deployment:

    image

    and finally click the Deploy button.  Your files will begin copying:

    image

    And then you will see your package getting deployed:

    image

    Then once it is deployed, you can click Run and your application will begin initializing:

    image

    This took a while for me but eventually it finished (I actually went to lunch so I am not sure how long it took but it was greater than 10 minutes).

    image

    And now when you browse to the cloudapp.net web site url on your console you will get your Windows Azure Hello World:

    image

    image

    And there you have it… a successfully created and deployed (and running) Windows Azure Hello World application from beginning to end. 

    DON'T FORGET: Make sure your DELETE your hosted service deployment when you are finished trying out Windows Azure.  The introductory offer only includes 25 hours of compute time.  You can easily burn through that by just leaving your deployment running (faster if you have both a staging and production deployment running).  And only suspended it does not stop the hours from accumulating.  You will need to DELETE the hosted service deployment to stop the compute hours from accumulating.



  • Getting Started with Windows Azure: Part 1 - Setting up your development environment

    Follow along as I learn all about Windows Azure.

    Part 0 - Where do I go to get started? 
    Part 1 - Setting up your development environment <<<< YOU ARE HERE
    Part 2 - Creating a Windows Azure Hello World Application

    From the Windows Azure Getting Started Roadmap there are some bullet points on how to get started with your development environment.

    image

    I did download the Windows Azure Platform Training Kit but it is a 122MB download with what looks like tons of great samples but feels a bit too overwhelming right now.  I will move onto Step 2 - Configuring your machine and see if I need to come back to the Training Kit later.

    I am running Windows Server 2008 and have Visual Studio 2008 SP1 and SQL Server 2008 installed.  I did download and install the 3 hotfixes listed at the bottom.  Some of them said they were not required after I ran them.  I also confirmed that I had WCF Activation installed along with HTTP Activation.

    image

    Step 3 – Download Tools & SDK: I let the Web Platform Installer take care of this for me.  It is possible that the Web Platform Installer would have done the other Step 2 items too but I am not sure.

    Step 4 – Windows Azure Sample Application is an old application from August 2009 with comments from people that it does not work anymore.  I skipped that.

    So at this point I think my development environment is setup but I am not sure though since I don’t have a Hello World to try out.  I will update this blog post as I learn more.  My next post will show how to create that first Windows Azure Hello World Application.

    Follow along as I learn all about Windows Azure… next up:
             Part 2 – Creating a Windows Azure Hello World Application



  • Getting Started with Windows Azure: Part 0 – Where do I go to get started?

    I am trying to get started with Windows Azure for the first time so I am going to dive in and see how things go.  Follow along as I learn all about Windows Azure.

    Part 0 - Where do I go to get started? <<< YOU ARE HERE
    Part 1 - Setting up your development environment
    Part 2 - Creating a Windows Azure Hello World Application

    The first thing I did was go to the Windows Azure Platform home page.  There are several different parts to the Windows Azure Platform (Windows Azure, SQL Azure, AppFabric) which I still have to learn about but I am not quite ready for what those are so I watched the high-level “What is Windows Azure” video.  It is a great video by Steve Marx to get you oriented with Windows Azure and I highly recommend it. 

    http://www.microsoft.com/windowsazure/windowsazure/video/what_is_windowsazure.aspx

    image

    After watching the video, I pretty much wanted to know how to get started.  Clicking on the Developer menu item and choosing Get Started:

    image

    Gave a road map on where to go; the Windows Azure Getting Started Roadmap:

     image

    I will continue following this road map in my next post Getting Started with Windows Azure: Part 1 – Setting up your development environment.


     

     

    Here are some first impression notes I took in case anyone is interested:

    Exactly how to get started was not very intuitive; I couldn’t find a “Get Started” or “Sign Up Now” button.  My eyes kept going to the bright orange “Web” button at the top and I think I read it multiple times really really wanting it to be a “Sign Up” bottom. 

    image

    I did notice the “Learn More” and “Get Tools & SDK” but neither of those addressed what I really wanted.  I think I had learned enough for now and “Get Tools & SDK” felt too deep for right now.  I just wanted to “Get Started”.

    image

    Eventually I noticed the Developer menu item and the “Get Started” sub item and found the road map I wanted.  The funny thing is… if I had actually clicked the “Learn More” button I would have ended up on the exact same Windows Azure Getting Started page as I had found under Developers > Get Started.  Also I didn’t even notice the “Get Started Now” heading  and text above the green Learn More button:

    image