Home > SharePoint > Hello world …

Hello world …

2011/06/10

Sometimes to obtain a simple “Hello world” message is not so easy.

In the ’80s , when i started my activity as programmer , the things was more easy; and in these ancient times we (old programmers with white hair) were producing working solutions in less time : sincerely i’m doubting if all these new technologies (Cloud, Moss, Mvc…) are really useful , because every new buzzword means days and days of searching on Google about strange error messages.

Many years ago there was an competition among C programmers ( i don’t know if is still active) , the winner was the one that wrote the most obscure but working code: this is my feeling when i ‘m losing my time in cases as the one described in this post.

Ok, in the ’80s to obtain technical infos was more difficult, there was not Google, forums.. you was constrained to read books (remember Kernighan & Ritchie? ) write a snail mail to a reader’s technical area of some magazine as Databased advisor, MC Microcomputer in Italy (high level articles)

I’m working with MOSS 2010 but even 2007, my activity with the 2007 was , until now, limited to maintain an existing site primarily with hundred of javascript lines for forms customizations, editing the pages with the Designer (a lot of crashes ….) , corrections to existing eventhandlers.

Now there is the problem of to write a particular webpart.

I was already using Visual Studio 2008 with vsewss 1.2 on the test virtual machine installed in the customer site, and i decided to try my ideas on my vm.

But i have noticed that there is the new 1.3 version of vsewss (http://www.microsoft.com/download/en/details.aspx?id=14154) , a new version tipically is better than the previous so i have downloaded the 1.3 version and, giving the fact that the previous 1.2 was working , i have immediately tried to create a webpart.

This is done by choosing in Visual studio to create a new web part in the SharePoint node,my code was very simple:

[Guid("45e055d6-3845-468d-a0e6-4a1166105f41")]
public class WebPart1 : System.Web.UI.WebControls.WebParts.WebPart
{
    public WebPart1()
    {
    }
 
    protected override void CreateChildControls()
    {
        base.CreateChildControls();
        Label label = new Label();
        label.Text = "Hello World";
        this.Controls.Add(label);
    }
}

in project properties-debug in “start browser with url” verify that there is your server address, Build and right clicking the project ->Deploy.

And i got the error:

The content type text/html; charset=utf-8 of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 1024 bytes of the response were: ‘<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd“>

What ? … and i started to search on Google until i found a post in the Microsoft forum which explain the same things that you can read in the rtf of Release notes downloadable from the vsewss 1.3 page.

Ok, my mistake to not read the Release notes, but in the error message could be indicated that the typical cause of this specific error could be the lacking of install the WCF http activation


and to insert the “Network service” in the administrators group !


And why not a simple message box by the end of the vsewss 1.3 installation ?…

After 2 hours , i got “hello world”…


Advertisements
Categories: SharePoint
%d bloggers like this: