HTTP Error 404.17 with IIS7 (Vista)

While playing with IIS 7 I accidental destroyed my IIS (XML) settings file. To fix this problem I copied the .XML from a colleague PC to mine. After this my IIS started giving a strange error:

HTTP Error 404.17 – Not Found – The requested content appears to be script and will not be served by the static file handler.

After a quick search I found out that I copied the .XML from a 32 bit PC to my 64 bit Vista and that all my Application Pools where now running on 64-bit. So my application stopped working because it's 32 bit.

To fix this problem go to IIS, right click your Application Pool and set the Enable 32-bit Applications to true.

 

Running WCF on IIS 7 (Vista)

I got the following errors when trying to run WCF on Vista:

The remote server returned an unexpected response: (404) Not Found.

HTTP Error 404.2 – Not Found
Description: The page you are requesting cannot be served because of the ISAPI and CGI Restriction list settings on the Web server.


– Add Mime Type: .svc : application/octet-stream

– run C:WindowsMicrosoft.NETFrameworkv3.0Windows Communication FoundationServiceModelReg.exe -i

http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/ce4c440a-1664-4695-b89c-a4790e2e865f/

Set: IIS Handler Mappings: *.svc extentsion to script

SILVERLIGHT WCF

XAP
Clientconfig:<endpoint address="http://hu.bachelor/HU%20Bachelor%203.Web/WebService.svc"

MSSQL: Database diagram support objects cannot be installed because this database does not gave a valid owner.

For a customer I needed to do a review there database (MSSQL 2000 database). For this I wanted to create some database diagrams. When I tried to create a diagram with Sql Sever Management Studio I got the following message:

"Database diagram support objects cannot be installed because this database does not gave a valid owner."

To fix this problem you need to set the owner and change the Compatibility Level of the database. You can do this with the following steps within Sql Sever Management Studio:

1. Right Click on your database, choose properties
2. Goto the Options Page
3. In the Dropdown at right labeled "Compatibility Level" choose "SQL Server 2005(90)"
4. Goto the Files Page
5. Enter "sa" in the owner textbox, or any other user you want to be the owner.
6. Click the OK button

Convert XmlElement to XElement (Extension Method)

I was using some web-services that returned there values in an XmlElement. I needed to convert this XmlElement to something that I can use with LINQ. I didn't find good solutions on the internet. So I started building my own convert logic. After all kinds of solutions I ended up with creating an new XmlDocument, adding the XmlElement to the XmlDocument and then convert the innerXml of the XmlDocument to an XElement. Not really nice but it does the trick.

I've rewritten the code into a Extension Method for the XmlElement.

[code:c#]

public static XElement ToXElement(this XmlElement xml)
{
   XmlDocument doc = new XmlDocument();

   doc.AppendChild(doc.ImportNode(xml, true));

   return XElement.Parse(doc.InnerXml);

}

[/code]


You use the Extension Method like this:

[code:c#]

XmlElement xmlElement = wsClient.DoWebServiceRequest();
XElement xml = xmlElement.ToXElement();

[/code]


Please tell me if you have a better way of doing this!

Cheers,
Pieter

Asp.Net Membership: Set url to the login page

The loginstatus control doesn't have a property to set the url of the login page. You need to set this URL in the web.config of your application.

Insert the login URL between the authentication node of the web.config. So it looks like this

[code:c#]

<authentication mode="Forms">
 <forms loginUrl="~/pages/login.aspx" />
</authentication>

[/code]

Change the value of the loginUrl to your login page.