<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>.NET - Software &amp; DotNetNuke (DNN) Blog</title>
    <link>http://www.dotnetnukeblog.de/</link>
    <description>.NET-Software-Entwicklung - DotNetNuke - Business-Develoment</description>
    <language>de-DE</language>
    <copyright>Daniel Müller</copyright>
    <lastBuildDate>Tue, 22 Nov 2011 17:29:45 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.2.8279.16125</generator>
    <managingEditor>mail@dotnetnukeblog.de</managingEditor>
    <webMaster>mail@dotnetnukeblog.de</webMaster>
    <item>
      <trackback:ping>http://www.dotnetnukeblog.de/Trackback.aspx?guid=230d5553-c68a-43d6-8e44-ac3d926890c9</trackback:ping>
      <pingback:server>http://www.dotnetnukeblog.de/pingback.aspx</pingback:server>
      <pingback:target>http://www.dotnetnukeblog.de/PermaLink,guid,230d5553-c68a-43d6-8e44-ac3d926890c9.aspx</pingback:target>
      <dc:creator>Daniel M</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">DotNetNuke bietet drei Möglichkeiten die
Passwörter von Benutzern zu speichern. Diese können im Klartext, als verschlüsselte
Zeichenfolge oder als Hashwert in der Datenbank gespeichert werden. Das die erste
Variante höchtens für Test- und Entwicklungsinstallationen in Frage kommt, muss wohl
nicht weiter diskutiert werden. Konfiguiert wird die Behandlung von Passwörtern in
der web.config direkt bei den Einstellungen des MembershipProvider:<br /><br /><pre><span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px">&lt;add
name=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">"AspNetSqlMembershipProvider"</span> type=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">"System.Web.Security.SqlMembershipProvider"</span> connectionStringName=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">"SiteSqlServer"</span> enablePasswordRetrieval=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">"true"</span> enablePasswordReset=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">"true"</span> requiresQuestionAndAnswer=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">"false"</span> minRequiredPasswordLength=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">"7"</span> minRequiredNonalphanumericCharacters=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">"0"</span> requiresUniqueEmail=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">"false"</span> passwordFormat=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">"Encrypted"</span> applicationName=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">"DotNetNuke"</span> /&gt; </span><br /></pre>Worin besteht aber der genau Unterschied zwischen veschlüsselt und hashed?<br /><br /><h3>Verschlüsselte Zeichenfolgen
</h3>
Bei diesem Modus werden die Passwörter durch einen Verschlüsselungsalgorithmus unleserlich
gemacht, so das bei einem Auslesen der Tabelle, die Passwörter nicht im Klartext zur
Verfügung stehen. DotNetNuke bzw. jedes DNN-Module ist in der Lage die Passwörter
ohne Probleme zu lesen. 
<br /><br /><h3>Hashwerte 
</h3>
Wenn man als Modus "Hashed" wählt, dann wird nur ein Hashwert vom Passwort abgespeichert
und nicht das eigentliche Passwort. Aus dem Hashwert kann man das Passwort nicht mehr
in Klartext umwandeln und somit hat auch kein Module mehr Zugriff auf die Passwörter.
Das bedeutet aber auch, dass die "Passwort zusenden"-Funktion nicht mehr das Passwort
dem Benutzer zur Verfügung stellen kann. Ob das eine Anwendung überhaupt machen sollte
ist eine ganz andere Diskussion. Die Funktion "Passwort vergessen" funktioniert aber
natürlich trotzdem, in diesem Modus wird von DotNetNuke einfach ein neues Zufallspasswort
erzeugt.<br /><br /><h3>Welche Variante
</h3>
Es gibt keine klare Empfehlung für eine der verfügbaren Methode. Für die Auswahl sollten
im Vorfeld Überlegungen angestellt werden, ob man das Passwort wirklich jemals im
Klartext benötigt. Aus der Perspektive eines Datenschützers wäre eigentlich nur die
Möglichkeit "als Hashwert" akzeptable. 
<br /><br /><br /><p></p><img width="0" height="0" src="http://www.dotnetnukeblog.de/aggbug.ashx?id=230d5553-c68a-43d6-8e44-ac3d926890c9" /></body>
      <title>DotNetNuke speichern von Zugangsdaten der Benutzer</title>
      <guid isPermaLink="false">http://www.dotnetnukeblog.de/PermaLink,guid,230d5553-c68a-43d6-8e44-ac3d926890c9.aspx</guid>
      <link>http://www.dotnetnukeblog.de/DotNetNuke+Speichern+Von+Zugangsdaten+Der+Benutzer.aspx</link>
      <pubDate>Tue, 22 Nov 2011 17:29:45 GMT</pubDate>
      <description>DotNetNuke bietet drei Möglichkeiten die Passwörter von Benutzern zu speichern. Diese können im Klartext, als verschlüsselte Zeichenfolge oder als Hashwert in der Datenbank gespeichert werden. Das die erste Variante höchtens für Test- und Entwicklungsinstallationen in Frage kommt, muss wohl nicht weiter diskutiert werden. Konfiguiert wird die Behandlung von Passwörtern in der web.config direkt bei den Einstellungen des MembershipProvider:&lt;br&gt;
&lt;br&gt;
&lt;pre&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;&amp;lt;add
name=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;"AspNetSqlMembershipProvider"&lt;/span&gt; type=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;"System.Web.Security.SqlMembershipProvider"&lt;/span&gt; connectionStringName=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;"SiteSqlServer"&lt;/span&gt; enablePasswordRetrieval=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;"true"&lt;/span&gt; enablePasswordReset=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;"true"&lt;/span&gt; requiresQuestionAndAnswer=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;"false"&lt;/span&gt; minRequiredPasswordLength=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;"7"&lt;/span&gt; minRequiredNonalphanumericCharacters=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;"0"&lt;/span&gt; requiresUniqueEmail=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;"false"&lt;/span&gt; passwordFormat=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;"Encrypted"&lt;/span&gt; applicationName=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;"DotNetNuke"&lt;/span&gt; /&amp;gt; &lt;/span&gt;
&lt;br&gt;
&lt;/pre&gt;Worin besteht aber der genau Unterschied zwischen veschlüsselt und hashed?&lt;br&gt;
&lt;br&gt;
&lt;h3&gt;Verschlüsselte Zeichenfolgen
&lt;/h3&gt;
Bei diesem Modus werden die Passwörter durch einen Verschlüsselungsalgorithmus unleserlich
gemacht, so das bei einem Auslesen der Tabelle, die Passwörter nicht im Klartext zur
Verfügung stehen. DotNetNuke bzw. jedes DNN-Module ist in der Lage die Passwörter
ohne Probleme zu lesen. 
&lt;br&gt;
&lt;br&gt;
&lt;h3&gt;Hashwerte 
&lt;/h3&gt;
Wenn man als Modus "Hashed" wählt, dann wird nur ein Hashwert vom Passwort abgespeichert
und nicht das eigentliche Passwort. Aus dem Hashwert kann man das Passwort nicht mehr
in Klartext umwandeln und somit hat auch kein Module mehr Zugriff auf die Passwörter.
Das bedeutet aber auch, dass die "Passwort zusenden"-Funktion nicht mehr das Passwort
dem Benutzer zur Verfügung stellen kann. Ob das eine Anwendung überhaupt machen sollte
ist eine ganz andere Diskussion. Die Funktion "Passwort vergessen" funktioniert aber
natürlich trotzdem, in diesem Modus wird von DotNetNuke einfach ein neues Zufallspasswort
erzeugt.&lt;br&gt;
&lt;br&gt;
&lt;h3&gt;Welche Variante
&lt;/h3&gt;
Es gibt keine klare Empfehlung für eine der verfügbaren Methode. Für die Auswahl sollten
im Vorfeld Überlegungen angestellt werden, ob man das Passwort wirklich jemals im
Klartext benötigt. Aus der Perspektive eines Datenschützers wäre eigentlich nur die
Möglichkeit "als Hashwert" akzeptable. 
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.dotnetnukeblog.de/aggbug.ashx?id=230d5553-c68a-43d6-8e44-ac3d926890c9" /&gt;</description>
      <category>ASP.NET</category>
      <category>DotNetNuke</category>
    </item>
    <item>
      <trackback:ping>http://www.dotnetnukeblog.de/Trackback.aspx?guid=a133ddb3-bba9-4dc0-9e5a-f565477e9739</trackback:ping>
      <pingback:server>http://www.dotnetnukeblog.de/pingback.aspx</pingback:server>
      <pingback:target>http://www.dotnetnukeblog.de/PermaLink,guid,a133ddb3-bba9-4dc0-9e5a-f565477e9739.aspx</pingback:target>
      <dc:creator>Daniel M</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">Die Performance einer Webseite ist heute
aus vielen Gründen - die hier nicht weiter aufgeführt werden müssen - wichtig. DotNetNuke
selber bietet eine Vielzahl von Einstellungen, die direkten Einfluss auf die Performance
der Webseite haben können. Es gibt auf Codeplex ein Projekt, dass durch ein paar SQL
Scripts die Einstellungen einer DotNetNuke Installation so modifiziert, das eine maximale
Performance möglich ist. 
<br /><br />
Natürlich muss man im Einzelfall über manche Einstellung extra entscheiden aber als
Startpunkt für eine Optimierung finde ich das sehr gelungen.<br /><br />
Das Projekt findet man unter <a href="http://dnnperformance.codeplex.com" target="_blank">http://dnnperformance.codeplex.com</a><br /><p></p><img width="0" height="0" src="http://www.dotnetnukeblog.de/aggbug.ashx?id=a133ddb3-bba9-4dc0-9e5a-f565477e9739" /></body>
      <title>DotNetNuke Performance Optimierung</title>
      <guid isPermaLink="false">http://www.dotnetnukeblog.de/PermaLink,guid,a133ddb3-bba9-4dc0-9e5a-f565477e9739.aspx</guid>
      <link>http://www.dotnetnukeblog.de/DotNetNuke+Performance+Optimierung.aspx</link>
      <pubDate>Thu, 17 Nov 2011 11:11:25 GMT</pubDate>
      <description>Die Performance einer Webseite ist heute aus vielen Gründen - die hier nicht weiter aufgeführt werden müssen - wichtig. DotNetNuke selber bietet eine Vielzahl von Einstellungen, die direkten Einfluss auf die Performance der Webseite haben können. Es gibt auf Codeplex ein Projekt, dass durch ein paar SQL Scripts die Einstellungen einer DotNetNuke Installation so modifiziert, das eine maximale Performance möglich ist. &lt;br&gt;
&lt;br&gt;
Natürlich muss man im Einzelfall über manche Einstellung extra entscheiden aber als
Startpunkt für eine Optimierung finde ich das sehr gelungen.&lt;br&gt;
&lt;br&gt;
Das Projekt findet man unter &lt;a href="http://dnnperformance.codeplex.com" target="_blank"&gt;http://dnnperformance.codeplex.com&lt;/a&gt;
&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.dotnetnukeblog.de/aggbug.ashx?id=a133ddb3-bba9-4dc0-9e5a-f565477e9739" /&gt;</description>
      <category>ASP.NET</category>
      <category>DotNetNuke</category>
      <category>Performance</category>
    </item>
    <item>
      <trackback:ping>http://www.dotnetnukeblog.de/Trackback.aspx?guid=b859ac36-66d3-4f53-9982-95ed0802d89f</trackback:ping>
      <pingback:server>http://www.dotnetnukeblog.de/pingback.aspx</pingback:server>
      <pingback:target>http://www.dotnetnukeblog.de/PermaLink,guid,b859ac36-66d3-4f53-9982-95ed0802d89f.aspx</pingback:target>
      <dc:creator>Daniel M</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">Je nach Modul gibt es schon mal die Anforderung,
dass neue Einträge in die web.config geschrieben werden müssen. Dieses kann man entweder
im SourceCode erledigen oder aber die Änderungen in dem DNN Modul Manifest / Definitionsdatei
(meinmodule.dnn) definieren. Verfügbar ist das ab der Version 5 von DotNetNuke. Um
das zu nutzen, muss man in der Manifest-Datei folgendes hinzufügen:<br /><br /><pre><span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px">&lt;component
type=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">"Config"</span>&gt;
&lt;config&gt; &lt;configFile&gt;web.config&lt;/configFile&gt; &lt;install&gt; &lt;configuration&gt;
&lt;nodes&gt;             .....
&lt;/nodes&gt; &lt;/configuration&gt; &lt;/install&gt; &lt;uninstall&gt; &lt;configuration&gt;
&lt;nodes /&gt; &lt;/configuration&gt; &lt;/uninstall&gt; &lt;/config&gt; &lt;/component&gt;</span></pre>Wie
man sieht gibt es zwei Bereiche. Der Bereich &lt;install&gt; wird während der Installation
und der Bereich &lt;uninstall&gt; wird be der Deinstallation von dem DNN Modul ausgeführt.<br /><br />
Innerhalb des Tags &lt;nodes&gt; können dann die entsprechenden Einträge hinzugefügt
werden. Hier ein Beispiel womit ein HttpHandler hinzugefügt wird:<br /><pre><span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;">&lt;node
path=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">"/configuration/system.web/httpHandlers"</span> action=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">"update"</span><br />
key=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">"path"</span> collision=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">"overwrite"</span>&gt;
&lt;add verb=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">"*"</span> path=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">"myhandler.axd"</span> validate=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">"false"</span><br />
type=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"</span></span><span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px"><span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">DNN.Module.Shop.MyHandler</span></span><span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px"><span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">,
DNN.Module.Shop"</span> /&gt; &lt;/node&gt;<br /></span></pre><br />
Weiter Informationen findet man im Wiki auf <a href="http://www.dotnetnuke.com/Resources/Wiki/Page/Manifest-Component-Installers-The-Config-Component.aspx" target="_blank">www.dotnetnuke.com</a><br /><p></p><img width="0" height="0" src="http://www.dotnetnukeblog.de/aggbug.ashx?id=b859ac36-66d3-4f53-9982-95ed0802d89f" /></body>
      <title>Die web.config bei der Installation eines Modules verändern</title>
      <guid isPermaLink="false">http://www.dotnetnukeblog.de/PermaLink,guid,b859ac36-66d3-4f53-9982-95ed0802d89f.aspx</guid>
      <link>http://www.dotnetnukeblog.de/Die+Webconfig+Bei+Der+Installation+Eines+Modules+Ver%c3%a4ndern.aspx</link>
      <pubDate>Thu, 27 Oct 2011 17:04:00 GMT</pubDate>
      <description>Je nach Modul gibt es schon mal die Anforderung, dass neue Einträge in die web.config geschrieben werden müssen. Dieses kann man entweder im SourceCode erledigen oder aber die Änderungen in dem DNN Modul Manifest / Definitionsdatei (meinmodule.dnn) definieren. Verfügbar ist das ab der Version 5 von DotNetNuke. Um das zu nutzen, muss man in der Manifest-Datei folgendes hinzufügen:&lt;br&gt;
&lt;br&gt;
&lt;pre&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;&amp;lt;component
type=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;"Config"&lt;/span&gt;&amp;gt;
&amp;lt;config&amp;gt; &amp;lt;configFile&amp;gt;web.config&amp;lt;/configFile&amp;gt; &amp;lt;install&amp;gt; &amp;lt;configuration&amp;gt;
&amp;lt;nodes&amp;gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.....
&amp;lt;/nodes&amp;gt; &amp;lt;/configuration&amp;gt; &amp;lt;/install&amp;gt; &amp;lt;uninstall&amp;gt; &amp;lt;configuration&amp;gt;
&amp;lt;nodes /&amp;gt; &amp;lt;/configuration&amp;gt; &amp;lt;/uninstall&amp;gt; &amp;lt;/config&amp;gt; &amp;lt;/component&amp;gt;&lt;/span&gt;&lt;/pre&gt;Wie
man sieht gibt es zwei Bereiche. Der Bereich &amp;lt;install&amp;gt; wird während der Installation
und der Bereich &amp;lt;uninstall&amp;gt; wird be der Deinstallation von dem DNN Modul ausgeführt.&lt;br&gt;
&lt;br&gt;
Innerhalb des Tags &amp;lt;nodes&amp;gt; können dann die entsprechenden Einträge hinzugefügt
werden. Hier ein Beispiel womit ein HttpHandler hinzugefügt wird:&lt;br&gt;
&lt;pre&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;&amp;lt;node
path=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;"/configuration/system.web/httpHandlers"&lt;/span&gt; action=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;"update"&lt;/span&gt; 
&lt;br&gt;
key=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;"path"&lt;/span&gt; collision=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;"overwrite"&lt;/span&gt;&amp;gt;
&amp;lt;add verb=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;"*"&lt;/span&gt; path=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;"myhandler.axd"&lt;/span&gt; validate=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;"false"&lt;/span&gt; 
&lt;br&gt;
type=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"&lt;/span&gt;&lt;/span&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;DNN.Module.Shop.MyHandler&lt;/span&gt;&lt;/span&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;,
DNN.Module.Shop"&lt;/span&gt; /&amp;gt; &amp;lt;/node&amp;gt;&lt;br&gt;
&lt;/span&gt;&lt;/pre&gt;
&lt;br&gt;
Weiter Informationen findet man im Wiki auf &lt;a href="http://www.dotnetnuke.com/Resources/Wiki/Page/Manifest-Component-Installers-The-Config-Component.aspx" target="_blank"&gt;www.dotnetnuke.com&lt;/a&gt;
&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.dotnetnukeblog.de/aggbug.ashx?id=b859ac36-66d3-4f53-9982-95ed0802d89f" /&gt;</description>
      <category>.NET</category>
      <category>ASP.NET</category>
      <category>DNN - Module</category>
      <category>DotNetNuke</category>
    </item>
    <item>
      <trackback:ping>http://www.dotnetnukeblog.de/Trackback.aspx?guid=6439022a-3bdd-4260-9ec7-1b8f566eb9ee</trackback:ping>
      <pingback:server>http://www.dotnetnukeblog.de/pingback.aspx</pingback:server>
      <pingback:target>http://www.dotnetnukeblog.de/PermaLink,guid,6439022a-3bdd-4260-9ec7-1b8f566eb9ee.aspx</pingback:target>
      <dc:creator>Daniel M</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">Jeder der sich schon mal mit dem Thema
Webdesign beschäftigt hat, kennt die Probleme der unterschiedlichen Browser. Besonders
der Internet Explorer ist ein Kandidat, bei dem man sehr schnell graue Haare bekommt
kann. 
<br /><br />
Meistens werden Hacks verwendet, die nur von bestimmten Versionen / Browsern erkannt
bzw. akzeptiert werden und von den anderen als Fehler ignoriert. 
<br /><br />
Das Problem von solchen Hacks ist unter anderem dafür sorgen das eine CSS nicht mehr
validiert werden kann. Um dieses Problem zu umgehen verwenden viele Conditional Stylesheets,
die dann vom jeweiligen Browser erkannt und geladen werden. Das sieht dann so aus:<br /><br /><pre><span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;">&lt;<span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px">link</span> rel=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">"stylesheet"</span> type=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">"text/css"</span> media=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">"screen"</span> href=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">"skin/css/style.css"</span> /&gt;
&lt;!--[<span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px">if</span> IE
7]&gt;&lt;<span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px">link</span> rel=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">"stylesheet"</span> type=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">"text/css"</span> media=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">"screen"</span> href=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"</span></span><span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px"><span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">skin/</span></span><span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;"><span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">css/ie7.css"</span> /&gt;&lt;
![endif]--&gt; &lt;!--[<span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px">if</span> IE
6]&gt;&lt;<span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px">link</span> rel=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">"stylesheet"</span> type=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">"text/css"</span> media=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">"screen"</span> href=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"</span></span><span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px"><span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">skin/</span></span><span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px"><span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">css/ie6.css"</span> /&gt;&lt;
![endif]--&gt;</span></pre>Nun kann man für die verschiedenen Browser(versionen) die
entsprecheden CSS-Definitionen sauber überschreiben. Ist doch super oder?<br /><br />
Diese Variante ist schon deutlich besser als die Verwendung von Hacks im eigentlichen
CSS aber hat den großen Nachteil das noch mehr Dateien vom Server geladen werden müssen. 
<br /><br />
Eine deutlich besser Lösung sieht so aus:<br /><pre><span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px"></span><span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;"></span><pre><span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px">&lt;!--[<span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px">if</span> lt
IE 7 ]&gt; &lt;html class=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">"ie6"</span>&gt;
&lt;![endif]--&gt; &lt;!--[<span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px">if</span> IE
7 ]&gt; &lt;html class=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">"ie7"</span>&gt;
&lt;![endif]--&gt; &lt;!--[<span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px">if</span> IE
8 ]&gt; &lt;html class=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">"ie8"</span>&gt;
&lt;![endif]--&gt; &lt;!--[<span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px">if</span> IE
9 ]&gt; &lt;html class=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">"ie9"</span>&gt;
&lt;![endif]--&gt; &lt;!--[<span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px">if</span> (gt
IE 9)<span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px">|</span>!(IE)]&gt;&lt;!--&gt;
&lt;html class=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">""</span>&gt;
&lt;!--&lt;![endif]--&gt;</span></pre></pre>Hier wird nun in Abhängigkeit von der
Browserversion das Tag HTML mit einer CSS-Klasse versehen und man kann nun ganz sauber
und ohne Hacks für die div. Versionen CSS-Definitionen erstellen, dass dann z.B. so
aussieht::<span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px"><br /><br />
div.contentpane { width: 510px; } 
<br />
.ie6 div.contentpane { width: 500px; }</span><br /><br />
Diese Technik wird z.B. auch vom bekannten <a href="http://html5boilerplate.com/" target="_blank">http://html5boilerplate.com/</a> verwendet.<br /><img width="0" height="0" src="http://www.dotnetnukeblog.de/aggbug.ashx?id=6439022a-3bdd-4260-9ec7-1b8f566eb9ee" /></body>
      <title>Conditional Stylesheets oder CSS hacks</title>
      <guid isPermaLink="false">http://www.dotnetnukeblog.de/PermaLink,guid,6439022a-3bdd-4260-9ec7-1b8f566eb9ee.aspx</guid>
      <link>http://www.dotnetnukeblog.de/Conditional+Stylesheets+Oder+CSS+Hacks.aspx</link>
      <pubDate>Wed, 19 Oct 2011 13:43:52 GMT</pubDate>
      <description>Jeder der sich schon mal mit dem Thema Webdesign beschäftigt hat, kennt die Probleme der unterschiedlichen Browser. Besonders der Internet Explorer ist ein Kandidat, bei dem man sehr schnell graue Haare bekommt kann. &lt;br&gt;
&lt;br&gt;
Meistens werden Hacks verwendet, die nur von bestimmten Versionen / Browsern erkannt
bzw. akzeptiert werden und von den anderen als Fehler ignoriert. 
&lt;br&gt;
&lt;br&gt;
Das Problem von solchen Hacks ist unter anderem dafür sorgen das eine CSS nicht mehr
validiert werden kann. Um dieses Problem zu umgehen verwenden viele Conditional Stylesheets,
die dann vom jeweiligen Browser erkannt und geladen werden. Das sieht dann so aus:&lt;br&gt;
&lt;br&gt;
&lt;pre&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;&amp;lt;&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;link&lt;/span&gt; rel=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;"stylesheet"&lt;/span&gt; type=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;"text/css"&lt;/span&gt; media=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;"screen"&lt;/span&gt; href=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;"skin/css/style.css"&lt;/span&gt; /&amp;gt;
&amp;lt;!--[&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;if&lt;/span&gt; IE
7]&amp;gt;&amp;lt;&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;link&lt;/span&gt; rel=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;"stylesheet"&lt;/span&gt; type=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;"text/css"&lt;/span&gt; media=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;"screen"&lt;/span&gt; href=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"&lt;/span&gt;&lt;/span&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;skin/&lt;/span&gt;&lt;/span&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;css/ie7.css"&lt;/span&gt; /&amp;gt;&amp;lt;
![endif]--&amp;gt; &amp;lt;!--[&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;if&lt;/span&gt; IE
6]&amp;gt;&amp;lt;&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;link&lt;/span&gt; rel=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;"stylesheet"&lt;/span&gt; type=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;"text/css"&lt;/span&gt; media=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;"screen"&lt;/span&gt; href=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"&lt;/span&gt;&lt;/span&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;skin/&lt;/span&gt;&lt;/span&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;css/ie6.css"&lt;/span&gt; /&amp;gt;&amp;lt;
![endif]--&amp;gt;&lt;/span&gt;&lt;/pre&gt;Nun kann man für die verschiedenen Browser(versionen) die
entsprecheden CSS-Definitionen sauber überschreiben. Ist doch super oder?&lt;br&gt;
&lt;br&gt;
Diese Variante ist schon deutlich besser als die Verwendung von Hacks im eigentlichen
CSS aber hat den großen Nachteil das noch mehr Dateien vom Server geladen werden müssen. 
&lt;br&gt;
&lt;br&gt;
Eine deutlich besser Lösung sieht so aus:&lt;br&gt;
&lt;pre&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;&lt;/span&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;&lt;/span&gt;&lt;pre&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;&amp;lt;!--[&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;if&lt;/span&gt; lt
IE 7 ]&amp;gt; &amp;lt;html class=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;"ie6"&lt;/span&gt;&amp;gt;
&amp;lt;![endif]--&amp;gt; &amp;lt;!--[&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;if&lt;/span&gt; IE
7 ]&amp;gt; &amp;lt;html class=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;"ie7"&lt;/span&gt;&amp;gt;
&amp;lt;![endif]--&amp;gt; &amp;lt;!--[&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;if&lt;/span&gt; IE
8 ]&amp;gt; &amp;lt;html class=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;"ie8"&lt;/span&gt;&amp;gt;
&amp;lt;![endif]--&amp;gt; &amp;lt;!--[&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;if&lt;/span&gt; IE
9 ]&amp;gt; &amp;lt;html class=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;"ie9"&lt;/span&gt;&amp;gt;
&amp;lt;![endif]--&amp;gt; &amp;lt;!--[&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;if&lt;/span&gt; (gt
IE 9)&lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;|&lt;/span&gt;!(IE)]&amp;gt;&amp;lt;!--&amp;gt;
&amp;lt;html class=&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;""&lt;/span&gt;&amp;gt;
&amp;lt;!--&amp;lt;![endif]--&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/pre&gt;Hier wird nun in Abhängigkeit von der
Browserversion das Tag HTML mit einer CSS-Klasse versehen und man kann nun ganz sauber
und ohne Hacks für die div. Versionen CSS-Definitionen erstellen, dass dann z.B. so
aussieht::&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt; 
&lt;br&gt;
&lt;br&gt;
div.contentpane { width: 510px; } 
&lt;br&gt;
.ie6 div.contentpane { width: 500px; }&lt;/span&gt;
&lt;br&gt;
&lt;br&gt;
Diese Technik wird z.B. auch vom bekannten &lt;a href="http://html5boilerplate.com/" target="_blank"&gt;http://html5boilerplate.com/&lt;/a&gt; verwendet.&lt;br&gt;
&lt;img width="0" height="0" src="http://www.dotnetnukeblog.de/aggbug.ashx?id=6439022a-3bdd-4260-9ec7-1b8f566eb9ee" /&gt;</description>
      <category>ASP.NET</category>
      <category>DNN Skin</category>
    </item>
    <item>
      <trackback:ping>http://www.dotnetnukeblog.de/Trackback.aspx?guid=1772d4b1-8a8c-4e30-b17b-f67d0d65c407</trackback:ping>
      <pingback:server>http://www.dotnetnukeblog.de/pingback.aspx</pingback:server>
      <pingback:target>http://www.dotnetnukeblog.de/PermaLink,guid,1772d4b1-8a8c-4e30-b17b-f67d0d65c407.aspx</pingback:target>
      <dc:creator>Daniel M</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">Immer wiedermal muss man in seinem Code
überprüfen welches Schema die URI (URL) besitzt. Daher sieht man oft solche Codezeilen:<span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px"><pre><span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px"><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px">if</span> (httpRequest.Uri.Scheme
== <span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px">"https"</span>)</span></pre><span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"></span></span>Ich
bin absolut kein Freund von solchen Abfragen, die auf einen String-Wert vergleichen,
den man selber schreiben muss. Das ist einfach viel zu Fehleranfällig und verleitet
auch durch Copy &amp; Paste und zu schnelles Tippen einfach Fehler zu machen... die
Abfrage ist ja auch wirklich zu einfach um länger drüber nachzudenken.<br /><br />
Dabei kann man sich das Leben auch einfacher machen und zumindest in meinen Augen
auch den Code richtig schreiben durch die Verwendung einer Konstanten aus dem .NET
Framework. Die Klasse URI besitzt nämlich schon bereits diese Konstanten!<br /><br />
Der Code von oben sieht dann plötzlich wie folgt aus:<br /><pre><span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px"><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px">if</span> (httpRequest.Uri.Scheme
== Uri.UriSchemeHttps)</span></pre>Hier einen Auszug der vordefinierten Werte:<br /><ul><li><b>UriSchemeFtp</b>: URI für  FTP (File Transfer Protocol).</li><li><b>UriSchemeHttp</b>: URI für HTTP (Hypertext Transfer Protocol) </li><li><b>UriSchemeHttps</b>: URI für HTTPS (Secure Hypertext Transfer Protocol).</li><li><b>UriSchemeMailto</b>: Gibt an, dass der URI eine E-Mail-Adresse ist und der Zugriff
über SMTP (Simple Mail Transport Protocol) erfolgt.</li><li><b>UriSchemeNetPipe</b>: Gibt an, dass auf den URI über das von Windows Communication
Foundation (WCF) verwendete NetPipe-Schema zugegriffen wird.</li><li><b>UriSchemeNetTcp</b>: Gibt an, dass auf den URI über das von Windows Communication
Foundation (WCF) verwendete NetTcp-Schema zugegriffen wird.</li><li><b>UriSchemeNntp</b>: URI für eine Internetnewsgroup, auf die über NNTP (Network News
Transport Protocol) zugegriffen wird</li></ul><br /><a href="http://msdn.microsoft.com/en-us/library/system.uri_fields.aspx" target="_blank">Details
gibt es hier</a>.<br /><p></p><img width="0" height="0" src="http://www.dotnetnukeblog.de/aggbug.ashx?id=1772d4b1-8a8c-4e30-b17b-f67d0d65c407" /></body>
      <title>URI schema constant </title>
      <guid isPermaLink="false">http://www.dotnetnukeblog.de/PermaLink,guid,1772d4b1-8a8c-4e30-b17b-f67d0d65c407.aspx</guid>
      <link>http://www.dotnetnukeblog.de/URI+Schema+Constant.aspx</link>
      <pubDate>Thu, 04 Aug 2011 08:38:59 GMT</pubDate>
      <description>Immer wiedermal muss man in seinem Code überprüfen welches Schema die URI (URL) besitzt. Daher sieht man oft solche Codezeilen:&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;&lt;pre&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;if&lt;/span&gt; (httpRequest.Uri.Scheme
== &lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;"https"&lt;/span&gt;)&lt;/span&gt;&lt;/pre&gt;&lt;span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px"&gt;&lt;/span&gt;&lt;/span&gt;Ich
bin absolut kein Freund von solchen Abfragen, die auf einen String-Wert vergleichen,
den man selber schreiben muss. Das ist einfach viel zu Fehleranfällig und verleitet
auch durch Copy &amp;amp; Paste und zu schnelles Tippen einfach Fehler zu machen... die
Abfrage ist ja auch wirklich zu einfach um länger drüber nachzudenken.&lt;br&gt;
&lt;br&gt;
Dabei kann man sich das Leben auch einfacher machen und zumindest in meinen Augen
auch den Code richtig schreiben durch die Verwendung einer Konstanten aus dem .NET
Framework. Die Klasse URI besitzt nämlich schon bereits diese Konstanten!&lt;br&gt;
&lt;br&gt;
Der Code von oben sieht dann plötzlich wie folgt aus:&lt;br&gt;
&lt;pre&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;if&lt;/span&gt; (httpRequest.Uri.Scheme
== Uri.UriSchemeHttps)&lt;/span&gt;&lt;/pre&gt;Hier einen Auszug der vordefinierten Werte:&lt;br&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;b&gt;UriSchemeFtp&lt;/b&gt;: URI für&amp;nbsp; FTP (File Transfer Protocol).&lt;/li&gt;
&lt;li&gt;
&lt;b&gt;UriSchemeHttp&lt;/b&gt;: URI für HTTP (Hypertext Transfer Protocol)&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;b&gt;UriSchemeHttps&lt;/b&gt;: URI für HTTPS (Secure Hypertext Transfer Protocol).&lt;/li&gt;
&lt;li&gt;
&lt;b&gt;UriSchemeMailto&lt;/b&gt;: Gibt an, dass der URI eine E-Mail-Adresse ist und der Zugriff
über SMTP (Simple Mail Transport Protocol) erfolgt.&lt;/li&gt;
&lt;li&gt;
&lt;b&gt;UriSchemeNetPipe&lt;/b&gt;: Gibt an, dass auf den URI über das von Windows Communication
Foundation (WCF) verwendete NetPipe-Schema zugegriffen wird.&lt;/li&gt;
&lt;li&gt;
&lt;b&gt;UriSchemeNetTcp&lt;/b&gt;: Gibt an, dass auf den URI über das von Windows Communication
Foundation (WCF) verwendete NetTcp-Schema zugegriffen wird.&lt;/li&gt;
&lt;li&gt;
&lt;b&gt;UriSchemeNntp&lt;/b&gt;: URI für eine Internetnewsgroup, auf die über NNTP (Network News
Transport Protocol) zugegriffen wird&lt;/li&gt;
&lt;/ul&gt;
&lt;br&gt;
&lt;a href="http://msdn.microsoft.com/en-us/library/system.uri_fields.aspx" target="_blank"&gt;Details
gibt es hier&lt;/a&gt;.&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.dotnetnukeblog.de/aggbug.ashx?id=1772d4b1-8a8c-4e30-b17b-f67d0d65c407" /&gt;</description>
      <category>.NET 4.0</category>
      <category>ASP.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.dotnetnukeblog.de/Trackback.aspx?guid=704d5790-d647-43e8-97b2-6f55d74ab4dc</trackback:ping>
      <pingback:server>http://www.dotnetnukeblog.de/pingback.aspx</pingback:server>
      <pingback:target>http://www.dotnetnukeblog.de/PermaLink,guid,704d5790-d647-43e8-97b2-6f55d74ab4dc.aspx</pingback:target>
      <dc:creator>Daniel M</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">Bei dem Versuch eine alte ASP (classic
asp) Anwendung auf einem Windows 2008 R2 System und damit auf einem IIS 7.5 funktionsfähig
zu bekommen bestand das Problem das die Seite immer nur einen HTTP Errorcode 500 zurück
gibt. Einen Blick in die Logs von IIS ergab die Fehlermeldung:<br /><br /><b>"|23|ASP_0131|Unzulässiger_Pfad_zum_übergeordneten_Verzeichnis"</b><br /><br />
Ursache dieses Problems ist das Standardmäßig der übergeordneten ASP-Pfade für eine
Website oder Anwendung bei gleichzeitiger Verwendung relativer übergeordneter Pfade
in einer Include-Anweisung nicht erlaubt / deaktiviert ist. 
<br /><br />
Empfohl ist die Einbindungen von 
<br /><br />
&lt;!--#include file="../dbconn.inc"--&gt;<br /><br />
auf<br /><br />
&lt;!--#include virtual="/&lt;virtual path&gt;/dbconn.inc"--&gt;<br /><br />
zu verändern. 
<br /><br />
Alternativ kann man aber auch den Internet Information Server so einstellen, dass
die übergeordneten ASP-Pfade erlaubt sind.<br /><br />
Dafür muss man beim IIS auf das entsprechende Web klicken und in der rechten Seite
unter ASP die Konfiguration öffnen. Dort gibt es dann die Option "<b>Übergeordnete
Pfade aktivieren</b>" der Wert muss von <b>False </b>auf <b>True </b>umgestellt werden.<br /><p></p><img width="0" height="0" src="http://www.dotnetnukeblog.de/aggbug.ashx?id=704d5790-d647-43e8-97b2-6f55d74ab4dc" /></body>
      <title>ASP 0131 Unzulaessiger Pfad zum uebergeordneten Verzeichnis</title>
      <guid isPermaLink="false">http://www.dotnetnukeblog.de/PermaLink,guid,704d5790-d647-43e8-97b2-6f55d74ab4dc.aspx</guid>
      <link>http://www.dotnetnukeblog.de/ASP+0131+Unzulaessiger+Pfad+Zum+Uebergeordneten+Verzeichnis.aspx</link>
      <pubDate>Sun, 31 Jul 2011 12:12:56 GMT</pubDate>
      <description>Bei dem Versuch eine alte ASP (classic asp) Anwendung auf einem Windows 2008 R2 System und damit auf einem IIS 7.5 funktionsfähig zu bekommen bestand das Problem das die Seite immer nur einen HTTP Errorcode 500 zurück gibt. Einen Blick in die Logs von IIS ergab die Fehlermeldung:&lt;br&gt;
&lt;br&gt;
&lt;b&gt;"|23|ASP_0131|Unzulässiger_Pfad_zum_übergeordneten_Verzeichnis"&lt;/b&gt;
&lt;br&gt;
&lt;br&gt;
Ursache dieses Problems ist das Standardmäßig der übergeordneten ASP-Pfade für eine
Website oder Anwendung bei gleichzeitiger Verwendung relativer übergeordneter Pfade
in einer Include-Anweisung nicht erlaubt / deaktiviert ist. 
&lt;br&gt;
&lt;br&gt;
Empfohl ist die Einbindungen von 
&lt;br&gt;
&lt;br&gt;
&amp;lt;!--#include file="../dbconn.inc"--&amp;gt;&lt;br&gt;
&lt;br&gt;
auf&lt;br&gt;
&lt;br&gt;
&amp;lt;!--#include virtual="/&amp;lt;virtual path&amp;gt;/dbconn.inc"--&amp;gt;&lt;br&gt;
&lt;br&gt;
zu verändern. 
&lt;br&gt;
&lt;br&gt;
Alternativ kann man aber auch den Internet Information Server so einstellen, dass
die übergeordneten ASP-Pfade erlaubt sind.&lt;br&gt;
&lt;br&gt;
Dafür muss man beim IIS auf das entsprechende Web klicken und in der rechten Seite
unter ASP die Konfiguration öffnen. Dort gibt es dann die Option "&lt;b&gt;Übergeordnete
Pfade aktivieren&lt;/b&gt;" der Wert muss von &lt;b&gt;False &lt;/b&gt;auf &lt;b&gt;True &lt;/b&gt;umgestellt werden.&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.dotnetnukeblog.de/aggbug.ashx?id=704d5790-d647-43e8-97b2-6f55d74ab4dc" /&gt;</description>
      <category>ASP.NET</category>
      <category>IIS</category>
    </item>
    <item>
      <trackback:ping>http://www.dotnetnukeblog.de/Trackback.aspx?guid=9527c34c-4d61-4c04-8f6d-3093fe9471c8</trackback:ping>
      <pingback:server>http://www.dotnetnukeblog.de/pingback.aspx</pingback:server>
      <pingback:target>http://www.dotnetnukeblog.de/PermaLink,guid,9527c34c-4d61-4c04-8f6d-3093fe9471c8.aspx</pingback:target>
      <dc:creator>Daniel M</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">Gerade habe ich eine ältere Sicherung in
den Mircosoft SQL Express 2008 eingespielt. Dabei wollte ich ein wenig aufräumen und
die nicht benötigten Benutzerkonten löschen. Jedoch habe ich bei dem Versuch immer
die Fehlermeldung<br /><br />
"The database principal owns a schema in the database, and cannot be dropped. (Microsoft
SQL Server, Error: 15138)." 
<br /><br />
bekommen. Die Lösung für dieses Problem ist recht einfach: Wenn für den Benutzeraccount
ein Schema angelegt wurde, muss zunächst das Schema aus der SQL Server Datenbank entfernt
werden. Um zu überprüfen, ob es ein Schema für den Benutzer gibt, kann man mit dem
SQL Server Manager bei der entsprechenden Datenbank unter Sicherheit =&gt; Schema
nachschauen. Wenn kein Schema mehr von diesem Benutzer existiert, lässt sich auch
das Benutzerkonto ohne Fehlermeldung löschen.<br /><br /><br /><p></p><img width="0" height="0" src="http://www.dotnetnukeblog.de/aggbug.ashx?id=9527c34c-4d61-4c04-8f6d-3093fe9471c8" /></body>
      <title>Microsoft SQL Server Error: 15138 drop user account</title>
      <guid isPermaLink="false">http://www.dotnetnukeblog.de/PermaLink,guid,9527c34c-4d61-4c04-8f6d-3093fe9471c8.aspx</guid>
      <link>http://www.dotnetnukeblog.de/Microsoft+SQL+Server+Error+15138+Drop+User+Account.aspx</link>
      <pubDate>Wed, 22 Jun 2011 22:16:40 GMT</pubDate>
      <description>Gerade habe ich eine ältere Sicherung in den Mircosoft SQL Express 2008 eingespielt. Dabei wollte ich ein wenig aufräumen und die nicht benötigten Benutzerkonten löschen. Jedoch habe ich bei dem Versuch immer die Fehlermeldung&lt;br&gt;
&lt;br&gt;
"The database principal owns a schema in the database, and cannot be dropped. (Microsoft
SQL Server, Error: 15138)." 
&lt;br&gt;
&lt;br&gt;
bekommen. Die Lösung für dieses Problem ist recht einfach: Wenn für den Benutzeraccount
ein Schema angelegt wurde, muss zunächst das Schema aus der SQL Server Datenbank entfernt
werden. Um zu überprüfen, ob es ein Schema für den Benutzer gibt, kann man mit dem
SQL Server Manager bei der entsprechenden Datenbank unter Sicherheit =&amp;gt; Schema
nachschauen. Wenn kein Schema mehr von diesem Benutzer existiert, lässt sich auch
das Benutzerkonto ohne Fehlermeldung löschen.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.dotnetnukeblog.de/aggbug.ashx?id=9527c34c-4d61-4c04-8f6d-3093fe9471c8" /&gt;</description>
      <category>SQL Server</category>
    </item>
    <item>
      <trackback:ping>http://www.dotnetnukeblog.de/Trackback.aspx?guid=df16ec60-7479-4d47-9c0f-30943bfd4459</trackback:ping>
      <pingback:server>http://www.dotnetnukeblog.de/pingback.aspx</pingback:server>
      <pingback:target>http://www.dotnetnukeblog.de/PermaLink,guid,df16ec60-7479-4d47-9c0f-30943bfd4459.aspx</pingback:target>
      <dc:creator>Daniel M</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Für mein aktuelles API Projekt erstelle ich eigene <b>Helppages </b>auf denen ich
auch Requestbeispiele für Xml und Json anzeige. Die Erstellung eines Request-Beispiel
wird durch <b>Xsd </b>erstellt und das resultierende Xml wird dann durch <b>Json.NET</b> in
Json konvertiert.
</p>
        <p>
Der Aufruf dazu sah wie folgt aus:<br /><br /></p>
        <pre>
          <span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;">var
jsonSample <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span> JsonConvert.SerializeXNode(xmlSampelRequest);</span>
        </pre>
        <p>
        </p>
        <p>
Als Ergebnis wurde auch Json ausgebeben, leider aber ohne Zeilenumbrüche, was die
Darstellung und Lesbarkeit doch stark reduziert. Damit der Json-String auch "vernüftig"
formatiert wird, kann man bei der Serializierung noch einen Parameter setzen und damit
die Formatierung erzwingen: <b>Formatting.Indented</b></p>
        <p>
Der Aufruf sieht dann wie folgt aus:<br /></p>
        <pre>
          <span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;">var
jsonSample <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span> JsonConvert.SerializeXNode(xmlSampelRequest,
Newtonsoft.Json.Formatting.Indented);</span>
        </pre>
        <p>
        </p>
        <img width="0" height="0" src="http://www.dotnetnukeblog.de/aggbug.ashx?id=df16ec60-7479-4d47-9c0f-30943bfd4459" />
      </body>
      <title>API REST Html-Helppage display Json requestsample </title>
      <guid isPermaLink="false">http://www.dotnetnukeblog.de/PermaLink,guid,df16ec60-7479-4d47-9c0f-30943bfd4459.aspx</guid>
      <link>http://www.dotnetnukeblog.de/API+REST+HtmlHelppage+Display+Json+Requestsample.aspx</link>
      <pubDate>Tue, 15 Mar 2011 10:13:49 GMT</pubDate>
      <description>&lt;p&gt;
Für mein aktuelles API Projekt erstelle ich eigene &lt;b&gt;Helppages &lt;/b&gt;auf denen ich
auch Requestbeispiele für Xml und Json anzeige. Die Erstellung eines Request-Beispiel
wird durch &lt;b&gt;Xsd &lt;/b&gt;erstellt und das resultierende Xml wird dann durch &lt;b&gt;Json.NET&lt;/b&gt; in
Json konvertiert.
&lt;/p&gt;
&lt;p&gt;
Der Aufruf dazu sah wie folgt aus:&lt;br&gt;
&lt;br&gt;
&lt;/p&gt;
&lt;pre&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;var
jsonSample &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; JsonConvert.SerializeXNode(xmlSampelRequest);&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
Als Ergebnis wurde auch Json ausgebeben, leider aber ohne Zeilenumbrüche, was die
Darstellung und Lesbarkeit doch stark reduziert. Damit der Json-String auch "vernüftig"
formatiert wird, kann man bei der Serializierung noch einen Parameter setzen und damit
die Formatierung erzwingen: &lt;b&gt;Formatting.Indented&lt;/b&gt;
&lt;/p&gt;
&lt;p&gt;
Der Aufruf sieht dann wie folgt aus:&lt;br&gt;
&lt;/p&gt;
&lt;pre&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;var
jsonSample &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; JsonConvert.SerializeXNode(xmlSampelRequest,
Newtonsoft.Json.Formatting.Indented);&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.dotnetnukeblog.de/aggbug.ashx?id=df16ec60-7479-4d47-9c0f-30943bfd4459" /&gt;</description>
      <category>API</category>
      <category>ASP.NET</category>
      <category>WCF</category>
    </item>
    <item>
      <trackback:ping>http://www.dotnetnukeblog.de/Trackback.aspx?guid=cc07a262-24a0-4297-87e5-a13dc5d1ef2b</trackback:ping>
      <pingback:server>http://www.dotnetnukeblog.de/pingback.aspx</pingback:server>
      <pingback:target>http://www.dotnetnukeblog.de/PermaLink,guid,cc07a262-24a0-4297-87e5-a13dc5d1ef2b.aspx</pingback:target>
      <dc:creator>Daniel M</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">In einem Projekt verwende ich aktuell die
Komponente <b>AutoMapper</b> (automapper.codeplex.com), im zwischen den externen Datacontracts
und den internen Entities zu mappen. Teilweise habe ich dafür auch eigenen TypeConverter
entwickelt. Wenn man in diesem <b>TypeConverter</b> eine eigene Exception auslöst,
dann erhält man beim aufrufenden Code immer eine <b>AutoMapperMappingException</b>.<br /><br />
Da ich in dem Projekt ein globales ErrorHandling habe (<b>WCF</b> bzw. Implementierung
vom IErrorHandler), möchte ich aber die konkrete Exception gerne aus dem TypeConverter
in mein Errorhandling weitergeben. 
<br /><br />
Damit das funktioniert baut man sich am besten einen Wrapper für den Aufruf vom Automapper,
um dort zu entscheiden, welche Exception man weitergeben möchte. Die eigene Exception
wird als <b>InnerException</b> vom <b>AutoMapperMappingException </b>mitgeliefiert.
Durch überprüfung der InnerException kann man als feststellen, wie die aktuelle Exception
zu bahandeln ist.<br /><br />
Hier ein Beispiel:<br /><pre><span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;"><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">public</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">class</span> AutoMapperWrapper
{ <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">public</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">static</span> U
Map&lt;T, U&gt;( T source) { <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">try</span> { <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">return</span> Mapper.Map&lt;T,
U&gt;(source); } <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">catch</span> (Exception
e) { <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">while</span> (e <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">is</span> AutoMapperMappingException)
e <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span> e.InnerException; <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">if</span> (e
== <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">null</span>) <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">throw</span>; <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">else</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">throw</span> e;
} } }</span></pre><br /><br /><br /><p></p><img width="0" height="0" src="http://www.dotnetnukeblog.de/aggbug.ashx?id=cc07a262-24a0-4297-87e5-a13dc5d1ef2b" /></body>
      <title>Automapper custom TypeConverter Exceptionhandling </title>
      <guid isPermaLink="false">http://www.dotnetnukeblog.de/PermaLink,guid,cc07a262-24a0-4297-87e5-a13dc5d1ef2b.aspx</guid>
      <link>http://www.dotnetnukeblog.de/Automapper+Custom+TypeConverter+Exceptionhandling.aspx</link>
      <pubDate>Fri, 11 Mar 2011 12:44:49 GMT</pubDate>
      <description>In einem Projekt verwende ich aktuell die Komponente &lt;b&gt;AutoMapper&lt;/b&gt; (automapper.codeplex.com),
im zwischen den externen Datacontracts und den internen Entities zu mappen. Teilweise
habe ich dafür auch eigenen TypeConverter entwickelt. Wenn man in diesem &lt;b&gt;TypeConverter&lt;/b&gt; eine
eigene Exception auslöst, dann erhält man beim aufrufenden Code immer eine &lt;b&gt;AutoMapperMappingException&lt;/b&gt;.&lt;br&gt;
&lt;br&gt;
Da ich in dem Projekt ein globales ErrorHandling habe (&lt;b&gt;WCF&lt;/b&gt; bzw. Implementierung
vom IErrorHandler), möchte ich aber die konkrete Exception gerne aus dem TypeConverter
in mein Errorhandling weitergeben. 
&lt;br&gt;
&lt;br&gt;
Damit das funktioniert baut man sich am besten einen Wrapper für den Aufruf vom Automapper,
um dort zu entscheiden, welche Exception man weitergeben möchte. Die eigene Exception
wird als &lt;b&gt;InnerException&lt;/b&gt; vom &lt;b&gt;AutoMapperMappingException &lt;/b&gt;mitgeliefiert.
Durch überprüfung der InnerException kann man als feststellen, wie die aktuelle Exception
zu bahandeln ist.&lt;br&gt;
&lt;br&gt;
Hier ein Beispiel:&lt;br&gt;
&lt;pre&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;public&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;class&lt;/span&gt; AutoMapperWrapper
{ &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;public&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;static&lt;/span&gt; U
Map&amp;lt;T, U&amp;gt;( T source) { &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;try&lt;/span&gt; { &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;return&lt;/span&gt; Mapper.Map&amp;lt;T,
U&amp;gt;(source); } &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;catch&lt;/span&gt; (Exception
e) { &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;while&lt;/span&gt; (e &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;is&lt;/span&gt; AutoMapperMappingException)
e &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; e.InnerException; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;if&lt;/span&gt; (e
== &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;null&lt;/span&gt;) &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;throw&lt;/span&gt;; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;else&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;throw&lt;/span&gt; e;
} } }&lt;/span&gt;&lt;/pre&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.dotnetnukeblog.de/aggbug.ashx?id=cc07a262-24a0-4297-87e5-a13dc5d1ef2b" /&gt;</description>
      <category>.NET</category>
      <category>WCF</category>
    </item>
    <item>
      <trackback:ping>http://www.dotnetnukeblog.de/Trackback.aspx?guid=f734a585-6339-42f8-b310-b3ce19a73f19</trackback:ping>
      <pingback:server>http://www.dotnetnukeblog.de/pingback.aspx</pingback:server>
      <pingback:target>http://www.dotnetnukeblog.de/PermaLink,guid,f734a585-6339-42f8-b310-b3ce19a73f19.aspx</pingback:target>
      <dc:creator>Daniel M</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">Wenn man mit der WCF einen Service definiert
und dabei Nachrichtenbasiert kommunizieren möchte, sieht kann die Definition z.B.
so aussehen:<br /><br /><pre><span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;">[ServiceContract(Namespace <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span> APICommon.DefaultSOAPNameSpace)]<br /><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">public</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">interface</span> ICartSoapService<br />
{<br />
[OperationContract]<br />
ProcessCartResponse ProcessCart(ProcessCartRequest request);<br />
}<br /><br /><br />
[DataContract]<br /><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">public</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">class</span> ProcessCartRequest<br />
{<br />
[DataMember(IsRequired <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">true</span>)]<br /><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">public</span> Cart
Cart<br />
{<br />
get;<br />
set;<br />
}<br />
}<br /><br />
[DataContract]<br /><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">public</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">class</span> ProcessCartResponse
: BaseResponseMessage<br />
{<br />
[DataMember(IsRequired <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">true</span>)]<br /><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">public</span> ProcessResultType
ProcessResult<br />
{<br />
get;<br />
set;<br />
}<br />
}</span></pre>Die WCF erzeugt auch brav eine passendes Wsdl Datei für diese Beschreibung.
Allerdings hat die "Standardausgabe" der WCF datei den Nachteil, das der Parameter
"request" der Methode ProcessCart immer optionaler Parameter ist bzw. in der Wsdl
Datei wird das Element mit den Attribute<b> minOccurs="0"</b> gekennezichnet. Da ohne
den Parameter die Methode aber nicht vernüftig abgearbeitet werden kann, müsste im
Wsdl eigentlich ein <b>minOccurs="1" </b>stehen ...also kein optionaler Parameter. 
<br /><br />
Leider gibt es bei den Standardattributen der WCF keine Möglichkeit, diese Verhalten
oder viel mehr die Wsdl-Generierung zu beinflussen. Trotzdem kann man durch ein eigenes
Attribute das gewünschte Verhalten sehr schnell der WCF beibringen.<br /><br />
Dafür muss man lediglich ein <b>Attribute </b>anlegen und die Interfaces <b>IContractBehavior </b>+ <b>IWsdlExportExtension </b>mit
hinzufügen. Die vollständige Implementierung sieht so aus:<br /><br /><pre><span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;"> [AttributeUsage(AttributeTargets.Interface)]<br /><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">public</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">class</span> OperationsParametersAreRequiredAttribute
: Attribute, 
<br />
IContractBehavior, IWsdlExportExtension<br />
{<br /><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">private</span> List&lt;RequiredOperationParameter&gt;
_requiredOperationParameters;<br /><br /><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">public</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">void</span> AddBindingParameters(<br />
ContractDescription contractDescription,<br />
ServiceEndpoint endpoint,<br />
System.ServiceModel.Channels.BindingParameterCollection bindingParameters)<br />
{<br />
}<br /><br /><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">public</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">void</span> ApplyClientBehavior(<br />
ContractDescription contractDescription,<br />
ServiceEndpoint endpoint,<br />
System.ServiceModel.Dispatcher.ClientRuntime clientRuntime)<br />
{<br />
}<br /><br /><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">public</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">void</span> ApplyDispatchBehavior(<br />
ContractDescription contractDescription,<br />
ServiceEndpoint endpoint,<br />
System.ServiceModel.Dispatcher.DispatchRuntime dispatchRuntime)<br />
{<br />
}<br /><br /><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">public</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">void</span> ExportContract(<br />
WsdlExporter exporter,<br />
WsdlContractConversionContext context)<br />
{<br /><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">if</span> (_requiredOperationParameters
== <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">null</span>)<br />
_requiredOperationParameters <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">new</span> List&lt;RequiredOperationParameter&gt;();<br /><br /><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">foreach</span> (var
operation <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">in</span> context.Contract.Operations)<br />
{<br />
var requestMessage <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span> operation.Messages.Where(m
=&gt; m.Direction ==<br />
MessageDirection.Input).FirstOrDefault();<br />
var parameters <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span> operation.SyncMethod.GetParameters();<br />
Debug.Assert(parameters.Length == requestMessage.Body.Parts.Count);<br /><br /><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">for</span> (var
iLoop <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span> 0;
iLoop &lt; parameters.Length; iLoop++)<br />
{<br />
var attributes <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span> parameters[iLoop].GetCustomAttributes(<span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"><br />
typeof</span>(OperationParameterIsOptionalAttribute), <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">false</span>);<br /><br /><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">if</span> (attributes.Length
== 0)<br />
{<br />
_requiredOperationParameters.Add(<span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">new</span> RequiredOperationParameter<br />
{<br />
Namespace <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span> requestMessage.Body.Parts[iLoop].Namespace,<br />
Name <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span> requestMessage.Body.Parts[iLoop].Name,<br />
Message <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span> operation.Name<br />
});<br />
}<br />
}<br />
}<br />
}<br /><br /><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">public</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">void</span> ExportEndpoint(<br />
WsdlExporter exporter,<br />
WsdlEndpointConversionContext context)<br />
{<br /><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">foreach</span> (var
requiredParamter <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">in</span> _requiredOperationParameters)<br />
{<br />
var schemas <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span> exporter.GeneratedXmlSchemas.Schemas(requiredParamter.Namespace);<br /><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">foreach</span> (XmlSchema
schema <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">in</span> schemas)<br />
{<br />
var message <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span> schema.Elements[requiredParamter.XmlName] <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">as</span> XmlSchemaElement;<br />
var complexType <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span> message.ElementSchemaType <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">as</span> XmlSchemaComplexType;<br />
var sequence <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span> complexType.Particle <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">as</span> XmlSchemaSequence;<br /><br /><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">foreach</span> (XmlSchemaElement
schemaElement <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">in</span> sequence.Items)<br />
{<br /><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">if</span> (schemaElement.Name
== requiredParamter.Name)<br />
{<br />
schemaElement.MinOccurs <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span> 1;<br />
schemaElement.MinOccursString <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span><span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"1"</span>;<br /><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">break</span>;<br />
}<br />
}<br />
}<br />
}<br />
_requiredOperationParameters.Clear();<br />
}<br /><br /><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">public</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">void</span> Validate(<br />
ContractDescription contractDescription,<br />
ServiceEndpoint endpoint)<br />
{<br />
}<br /><br /><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">internal</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">class</span> RequiredOperationParameter<br />
{<br /><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">public</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">string</span> Message
{ get; set; }<br /><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">public</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">string</span> Name
{ get; set; }<br /><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">public</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">string</span> Namespace
{ get;set;}<br /><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">public</span> XmlQualifiedName
XmlName<br />
{<br />
get { <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">return</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">new</span> XmlQualifiedName(Message,
Namespace); }<br />
}<br />
}<br />
}</span></pre><br /><br /><br /><br /><p></p><img width="0" height="0" src="http://www.dotnetnukeblog.de/aggbug.ashx?id=f734a585-6339-42f8-b310-b3ce19a73f19" /></body>
      <title>WCF OperationContract nicht optionale Prameter im Wsdl </title>
      <guid isPermaLink="false">http://www.dotnetnukeblog.de/PermaLink,guid,f734a585-6339-42f8-b310-b3ce19a73f19.aspx</guid>
      <link>http://www.dotnetnukeblog.de/WCF+OperationContract+Nicht+Optionale+Prameter+Im+Wsdl.aspx</link>
      <pubDate>Wed, 02 Mar 2011 13:53:16 GMT</pubDate>
      <description>Wenn man mit der WCF einen Service definiert und dabei Nachrichtenbasiert kommunizieren möchte, sieht kann die Definition z.B. so aussehen:&lt;br&gt;
&lt;br&gt;
&lt;pre&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;[ServiceContract(Namespace &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; APICommon.DefaultSOAPNameSpace)]&lt;br&gt;
&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;public&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;interface&lt;/span&gt; ICartSoapService&lt;br&gt;
{&lt;br&gt;
[OperationContract]&lt;br&gt;
ProcessCartResponse ProcessCart(ProcessCartRequest request);&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
[DataContract]&lt;br&gt;
&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;public&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;class&lt;/span&gt; ProcessCartRequest&lt;br&gt;
{&lt;br&gt;
[DataMember(IsRequired &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;true&lt;/span&gt;)]&lt;br&gt;
&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;public&lt;/span&gt; Cart
Cart&lt;br&gt;
{&lt;br&gt;
get;&lt;br&gt;
set;&lt;br&gt;
}&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
[DataContract]&lt;br&gt;
&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;public&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;class&lt;/span&gt; ProcessCartResponse
: BaseResponseMessage&lt;br&gt;
{&lt;br&gt;
[DataMember(IsRequired &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;true&lt;/span&gt;)]&lt;br&gt;
&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;public&lt;/span&gt; ProcessResultType
ProcessResult&lt;br&gt;
{&lt;br&gt;
get;&lt;br&gt;
set;&lt;br&gt;
}&lt;br&gt;
}&lt;/span&gt;&lt;/pre&gt;Die WCF erzeugt auch brav eine passendes Wsdl Datei für diese Beschreibung.
Allerdings hat die "Standardausgabe" der WCF datei den Nachteil, das der Parameter
"request" der Methode ProcessCart immer optionaler Parameter ist bzw. in der Wsdl
Datei wird das Element mit den Attribute&lt;b&gt; minOccurs="0"&lt;/b&gt; gekennezichnet. Da ohne
den Parameter die Methode aber nicht vernüftig abgearbeitet werden kann, müsste im
Wsdl eigentlich ein &lt;b&gt;minOccurs="1" &lt;/b&gt;stehen ...also kein optionaler Parameter. 
&lt;br&gt;
&lt;br&gt;
Leider gibt es bei den Standardattributen der WCF keine Möglichkeit, diese Verhalten
oder viel mehr die Wsdl-Generierung zu beinflussen. Trotzdem kann man durch ein eigenes
Attribute das gewünschte Verhalten sehr schnell der WCF beibringen.&lt;br&gt;
&lt;br&gt;
Dafür muss man lediglich ein &lt;b&gt;Attribute &lt;/b&gt;anlegen und die Interfaces &lt;b&gt;IContractBehavior &lt;/b&gt;+ &lt;b&gt;IWsdlExportExtension &lt;/b&gt;mit
hinzufügen. Die vollständige Implementierung sieht so aus:&lt;br&gt;
&lt;br&gt;
&lt;pre&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt; [AttributeUsage(AttributeTargets.Interface)]&lt;br&gt;
&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;public&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;class&lt;/span&gt; OperationsParametersAreRequiredAttribute
: Attribute, 
&lt;br&gt;
IContractBehavior, IWsdlExportExtension&lt;br&gt;
{&lt;br&gt;
&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;private&lt;/span&gt; List&amp;lt;RequiredOperationParameter&amp;gt;
_requiredOperationParameters;&lt;br&gt;
&lt;br&gt;
&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;public&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;void&lt;/span&gt; AddBindingParameters(&lt;br&gt;
ContractDescription contractDescription,&lt;br&gt;
ServiceEndpoint endpoint,&lt;br&gt;
System.ServiceModel.Channels.BindingParameterCollection bindingParameters)&lt;br&gt;
{&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;public&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;void&lt;/span&gt; ApplyClientBehavior(&lt;br&gt;
ContractDescription contractDescription,&lt;br&gt;
ServiceEndpoint endpoint,&lt;br&gt;
System.ServiceModel.Dispatcher.ClientRuntime clientRuntime)&lt;br&gt;
{&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;public&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;void&lt;/span&gt; ApplyDispatchBehavior(&lt;br&gt;
ContractDescription contractDescription,&lt;br&gt;
ServiceEndpoint endpoint,&lt;br&gt;
System.ServiceModel.Dispatcher.DispatchRuntime dispatchRuntime)&lt;br&gt;
{&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;public&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;void&lt;/span&gt; ExportContract(&lt;br&gt;
WsdlExporter exporter,&lt;br&gt;
WsdlContractConversionContext context)&lt;br&gt;
{&lt;br&gt;
&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;if&lt;/span&gt; (_requiredOperationParameters
== &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;null&lt;/span&gt;)&lt;br&gt;
_requiredOperationParameters &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;new&lt;/span&gt; List&amp;lt;RequiredOperationParameter&amp;gt;();&lt;br&gt;
&lt;br&gt;
&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;foreach&lt;/span&gt; (var
operation &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;in&lt;/span&gt; context.Contract.Operations)&lt;br&gt;
{&lt;br&gt;
var requestMessage &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; operation.Messages.Where(m
=&amp;gt; m.Direction ==&lt;br&gt;
MessageDirection.Input).FirstOrDefault();&lt;br&gt;
var parameters &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; operation.SyncMethod.GetParameters();&lt;br&gt;
Debug.Assert(parameters.Length == requestMessage.Body.Parts.Count);&lt;br&gt;
&lt;br&gt;
&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;for&lt;/span&gt; (var
iLoop &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; 0;
iLoop &amp;lt; parameters.Length; iLoop++)&lt;br&gt;
{&lt;br&gt;
var attributes &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; parameters[iLoop].GetCustomAttributes(&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;
&lt;br&gt;
typeof&lt;/span&gt;(OperationParameterIsOptionalAttribute), &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;false&lt;/span&gt;);&lt;br&gt;
&lt;br&gt;
&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;if&lt;/span&gt; (attributes.Length
== 0)&lt;br&gt;
{&lt;br&gt;
_requiredOperationParameters.Add(&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;new&lt;/span&gt; RequiredOperationParameter&lt;br&gt;
{&lt;br&gt;
Namespace &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; requestMessage.Body.Parts[iLoop].Namespace,&lt;br&gt;
Name &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; requestMessage.Body.Parts[iLoop].Name,&lt;br&gt;
Message &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; operation.Name&lt;br&gt;
});&lt;br&gt;
}&lt;br&gt;
}&lt;br&gt;
}&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;public&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;void&lt;/span&gt; ExportEndpoint(&lt;br&gt;
WsdlExporter exporter,&lt;br&gt;
WsdlEndpointConversionContext context)&lt;br&gt;
{&lt;br&gt;
&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;foreach&lt;/span&gt; (var
requiredParamter &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;in&lt;/span&gt; _requiredOperationParameters)&lt;br&gt;
{&lt;br&gt;
var schemas &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; exporter.GeneratedXmlSchemas.Schemas(requiredParamter.Namespace);&lt;br&gt;
&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;foreach&lt;/span&gt; (XmlSchema
schema &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;in&lt;/span&gt; schemas)&lt;br&gt;
{&lt;br&gt;
var message &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; schema.Elements[requiredParamter.XmlName] &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;as&lt;/span&gt; XmlSchemaElement;&lt;br&gt;
var complexType &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; message.ElementSchemaType &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;as&lt;/span&gt; XmlSchemaComplexType;&lt;br&gt;
var sequence &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; complexType.Particle &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;as&lt;/span&gt; XmlSchemaSequence;&lt;br&gt;
&lt;br&gt;
&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;foreach&lt;/span&gt; (XmlSchemaElement
schemaElement &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;in&lt;/span&gt; sequence.Items)&lt;br&gt;
{&lt;br&gt;
&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;if&lt;/span&gt; (schemaElement.Name
== requiredParamter.Name)&lt;br&gt;
{&lt;br&gt;
schemaElement.MinOccurs &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; 1;&lt;br&gt;
schemaElement.MinOccursString &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; &lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"1"&lt;/span&gt;;&lt;br&gt;
&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;break&lt;/span&gt;;&lt;br&gt;
}&lt;br&gt;
}&lt;br&gt;
}&lt;br&gt;
}&lt;br&gt;
_requiredOperationParameters.Clear();&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;public&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;void&lt;/span&gt; Validate(&lt;br&gt;
ContractDescription contractDescription,&lt;br&gt;
ServiceEndpoint endpoint)&lt;br&gt;
{&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;internal&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;class&lt;/span&gt; RequiredOperationParameter&lt;br&gt;
{&lt;br&gt;
&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;public&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;string&lt;/span&gt; Message
{ get; set; }&lt;br&gt;
&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;public&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;string&lt;/span&gt; Name
{ get; set; }&lt;br&gt;
&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;public&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;string&lt;/span&gt; Namespace
{ get;set;}&lt;br&gt;
&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;public&lt;/span&gt; XmlQualifiedName
XmlName&lt;br&gt;
{&lt;br&gt;
get { &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;return&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;new&lt;/span&gt; XmlQualifiedName(Message,
Namespace); }&lt;br&gt;
}&lt;br&gt;
}&lt;br&gt;
}&lt;/span&gt;&lt;/pre&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.dotnetnukeblog.de/aggbug.ashx?id=f734a585-6339-42f8-b310-b3ce19a73f19" /&gt;</description>
      <category>.NET 4.0</category>
      <category>ASP.NET</category>
      <category>WCF</category>
    </item>
    <item>
      <trackback:ping>http://www.dotnetnukeblog.de/Trackback.aspx?guid=260f952d-8750-41fa-b925-d22dbaef7953</trackback:ping>
      <pingback:server>http://www.dotnetnukeblog.de/pingback.aspx</pingback:server>
      <pingback:target>http://www.dotnetnukeblog.de/PermaLink,guid,260f952d-8750-41fa-b925-d22dbaef7953.aspx</pingback:target>
      <dc:creator>Daniel M</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">Bei dem Versuch HTTP Basic Auth für einen
REST Dienst zu implementieren (der wiederrum durch Konfiguration per <b>serviceActivations</b> in
der .config und eigenere factory gestartet wird) bekam ich die Fehlermeldung bei der
Umstellung vom Attribute <b>aspNetCompatibilityEnabled</b> von <i>"false"</i> auf <i>"true"</i> 
das die Assembly 'System.ServiceModel.Activation' nicht gefunden werden konnte. 
<br /><br />
Hier die genaue Fehlermeldung:<br /><br />
 System.IO.FileNotFoundException: <b>Could not load file or assembly 'System.ServiceModel.Activation'
or one of its dependencies.</b> The system cannot find the file specified.<br />
File name: 'System.ServiceModel.Activation'<br />
   at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError,
Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, Boolean
loadTypeFromPartialName, ObjectHandleOnStack type)<br />
   at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError,
Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark&amp; stackMark, Boolean
loadTypeFromPartialName)<br />
   at System.Type.GetType(String typeName, Boolean throwOnError, Boolean
ignoreCase)<br />
   at System.Web.Compilation.BuildManager.GetType(String typeName, Boolean
throwOnError, Boolean ignoreCase)<br />
   at System.Web.Configuration.HandlerFactoryCache.GetTypeWithAssert(String
type)<br />
   at System.Web.Configuration.HandlerFactoryCache.GetHandlerType(String
type)<br />
   at System.Web.Configuration.HandlerFactoryCache..ctor(String type)<br />
   at System.Web.HttpApplication.GetFactory(String type)<br />
   at System.Web.HttpApplication.MaterializeHandlerExecutionStep.System.Web.<br />
                       
HttpApplication.IExecutionStep.Execute()<br />
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp;
completedSynchronously)<br /><br />
=== Pre-bind state information ===<br />
LOG: User = user<br />
LOG: DisplayName = System.ServiceModel.Activation<br />
 (Partial)<br />
WRN: Partial binding information was supplied for an assembly:<br />
WRN: Assembly Name: System.ServiceModel.Activation | Domain ID: 2<br />
WRN: A partial bind occurs when only part of the assembly display name is provided.<br />
WRN: This might result in the binder loading an incorrect assembly.<br />
WRN: It is recommended to provide a fully specified textual identity for the assembly,<br />
WRN: that consists of the simple name, version, culture, and public key token.<br />
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information
and common solutions to this issue.<br />
LOG: Appbase = file:///xxxxx/<br />
LOG: Initial PrivatePath xxxx\bin<br />
Calling assembly : (Unknown).<br />
===<br />
LOG: This bind starts in default load context.<br />
LOG: Using application configuration file: xxxx\web.config<br />
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config<br />
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.<br />
LOG: Policy not being applied to reference at this time (private, custom, partial,
or location-based assembly bind).<br />
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary
ASP.NET Files/root/3d7bd35f/452e5631/System.ServiceModel.Activation.DLL.<br />
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary
ASP.NET Files/root/3d7bd35f/452e5631/System.ServiceModel.Activation/System.ServiceModel.Activation.DLL.<br />
LOG: Attempting download of new URL file:///xxxx/bin/System.ServiceModel.Activation.DLL.<br />
LOG: Attempting download of new URL file:///Dxxxx/bin/System.ServiceModel.Activation/System.ServiceModel.Activation.DLL.<br />
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary
ASP.NET Files/root/3d7bd35f/452e5631/System.ServiceModel.Activation.EXE.<br />
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary
ASP.NET Files/root/3d7bd35f/452e5631/System.ServiceModel.Activation/System.ServiceModel.Activation.EXE.<br />
LOG: Attempting download of new URL file:///xxxx/bin/System.ServiceModel.Activation.EXE.<br />
LOG: Attempting download of new URL file:///xxxxx/bin/System.ServiceModel.Activation/System.ServiceModel.Activation.EXE.<br />
 - Thread: 15<br /><br />
Das Problem liegt an einem Eintrag in der <b>web.config</b>, denn dort hatte ich unter <b>system.webserver</b> -&gt; <b>handlers </b>folgenden
Eintrag hinzugefügt:<br /><br /><pre><span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;">&lt;add
name=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"svc"</span> path=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"*.svc"</span> verb=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"*"</span> type=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"<br />
System.ServiceModel.Activation.ServiceHttpHandlerFactory, System.ServiceModel.Activation"</span>/&gt;</span></pre>Nach
dem Ändern bzw. Ergänzen diesers Eintrages: 
<br /><pre><span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;">&lt;add
name=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"svc"</span> path=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"*.svc"</span> verb=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"*"</span> type=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"<br />
System.ServiceModel.Activation.ServiceHttpHandlerFactory,System.ServiceModel.Activation, 
<br />
Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"</span><br />
 preCondition=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"integratedMode,runtimeVersionv4.0"</span> /&gt;</span></pre>Funktioniert
auch wieder die Aktivierung vom WCF basierten REST Service.<br /><br /><p></p><img width="0" height="0" src="http://www.dotnetnukeblog.de/aggbug.ashx?id=260f952d-8750-41fa-b925-d22dbaef7953" /></body>
      <title>WCF REST  Could not load file or assembly 'System.ServiceModel.Activation' </title>
      <guid isPermaLink="false">http://www.dotnetnukeblog.de/PermaLink,guid,260f952d-8750-41fa-b925-d22dbaef7953.aspx</guid>
      <link>http://www.dotnetnukeblog.de/WCF+REST+Could+Not+Load+File+Or+Assembly+SystemServiceModelActivation.aspx</link>
      <pubDate>Wed, 19 Jan 2011 10:44:55 GMT</pubDate>
      <description>Bei dem Versuch HTTP Basic Auth für einen REST Dienst zu implementieren (der wiederrum durch Konfiguration per &lt;b&gt;serviceActivations&lt;/b&gt; in
der .config und eigenere factory gestartet wird) bekam ich die Fehlermeldung bei der
Umstellung vom Attribute &lt;b&gt;aspNetCompatibilityEnabled&lt;/b&gt; von &lt;i&gt;"false"&lt;/i&gt; auf &lt;i&gt;"true"&lt;/i&gt;&amp;nbsp;
das die Assembly 'System.ServiceModel.Activation' nicht gefunden werden konnte. 
&lt;br&gt;
&lt;br&gt;
Hier die genaue Fehlermeldung:&lt;br&gt;
&lt;br&gt;
&amp;nbsp;System.IO.FileNotFoundException: &lt;b&gt;Could not load file or assembly 'System.ServiceModel.Activation'
or one of its dependencies.&lt;/b&gt; The system cannot find the file specified.&lt;br&gt;
File name: 'System.ServiceModel.Activation'&lt;br&gt;
&amp;nbsp;&amp;nbsp; at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError,
Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, Boolean
loadTypeFromPartialName, ObjectHandleOnStack type)&lt;br&gt;
&amp;nbsp;&amp;nbsp; at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError,
Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark&amp;amp; stackMark, Boolean
loadTypeFromPartialName)&lt;br&gt;
&amp;nbsp;&amp;nbsp; at System.Type.GetType(String typeName, Boolean throwOnError, Boolean
ignoreCase)&lt;br&gt;
&amp;nbsp;&amp;nbsp; at System.Web.Compilation.BuildManager.GetType(String typeName, Boolean
throwOnError, Boolean ignoreCase)&lt;br&gt;
&amp;nbsp;&amp;nbsp; at System.Web.Configuration.HandlerFactoryCache.GetTypeWithAssert(String
type)&lt;br&gt;
&amp;nbsp;&amp;nbsp; at System.Web.Configuration.HandlerFactoryCache.GetHandlerType(String
type)&lt;br&gt;
&amp;nbsp;&amp;nbsp; at System.Web.Configuration.HandlerFactoryCache..ctor(String type)&lt;br&gt;
&amp;nbsp;&amp;nbsp; at System.Web.HttpApplication.GetFactory(String type)&lt;br&gt;
&amp;nbsp;&amp;nbsp; at System.Web.HttpApplication.MaterializeHandlerExecutionStep.System.Web.&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
HttpApplication.IExecutionStep.Execute()&lt;br&gt;
&amp;nbsp;&amp;nbsp; at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp;amp;
completedSynchronously)&lt;br&gt;
&lt;br&gt;
=== Pre-bind state information ===&lt;br&gt;
LOG: User = user&lt;br&gt;
LOG: DisplayName = System.ServiceModel.Activation&lt;br&gt;
&amp;nbsp;(Partial)&lt;br&gt;
WRN: Partial binding information was supplied for an assembly:&lt;br&gt;
WRN: Assembly Name: System.ServiceModel.Activation | Domain ID: 2&lt;br&gt;
WRN: A partial bind occurs when only part of the assembly display name is provided.&lt;br&gt;
WRN: This might result in the binder loading an incorrect assembly.&lt;br&gt;
WRN: It is recommended to provide a fully specified textual identity for the assembly,&lt;br&gt;
WRN: that consists of the simple name, version, culture, and public key token.&lt;br&gt;
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information
and common solutions to this issue.&lt;br&gt;
LOG: Appbase = file:///xxxxx/&lt;br&gt;
LOG: Initial PrivatePath xxxx\bin&lt;br&gt;
Calling assembly : (Unknown).&lt;br&gt;
===&lt;br&gt;
LOG: This bind starts in default load context.&lt;br&gt;
LOG: Using application configuration file: xxxx\web.config&lt;br&gt;
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config&lt;br&gt;
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.&lt;br&gt;
LOG: Policy not being applied to reference at this time (private, custom, partial,
or location-based assembly bind).&lt;br&gt;
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary
ASP.NET Files/root/3d7bd35f/452e5631/System.ServiceModel.Activation.DLL.&lt;br&gt;
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary
ASP.NET Files/root/3d7bd35f/452e5631/System.ServiceModel.Activation/System.ServiceModel.Activation.DLL.&lt;br&gt;
LOG: Attempting download of new URL file:///xxxx/bin/System.ServiceModel.Activation.DLL.&lt;br&gt;
LOG: Attempting download of new URL file:///Dxxxx/bin/System.ServiceModel.Activation/System.ServiceModel.Activation.DLL.&lt;br&gt;
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary
ASP.NET Files/root/3d7bd35f/452e5631/System.ServiceModel.Activation.EXE.&lt;br&gt;
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary
ASP.NET Files/root/3d7bd35f/452e5631/System.ServiceModel.Activation/System.ServiceModel.Activation.EXE.&lt;br&gt;
LOG: Attempting download of new URL file:///xxxx/bin/System.ServiceModel.Activation.EXE.&lt;br&gt;
LOG: Attempting download of new URL file:///xxxxx/bin/System.ServiceModel.Activation/System.ServiceModel.Activation.EXE.&lt;br&gt;
&amp;nbsp;- Thread: 15&lt;br&gt;
&lt;br&gt;
Das Problem liegt an einem Eintrag in der &lt;b&gt;web.config&lt;/b&gt;, denn dort hatte ich unter &lt;b&gt;system.webserver&lt;/b&gt; -&amp;gt; &lt;b&gt;handlers &lt;/b&gt;folgenden
Eintrag hinzugefügt:&lt;br&gt;
&lt;br&gt;
&lt;pre&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;&amp;lt;add
name=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"svc"&lt;/span&gt; path=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"*.svc"&lt;/span&gt; verb=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"*"&lt;/span&gt; type=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"&lt;br&gt;
System.ServiceModel.Activation.ServiceHttpHandlerFactory, System.ServiceModel.Activation"&lt;/span&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;Nach
dem Ändern bzw. Ergänzen diesers Eintrages: 
&lt;br&gt;
&lt;pre&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;&amp;lt;add
name=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"svc"&lt;/span&gt; path=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"*.svc"&lt;/span&gt; verb=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"*"&lt;/span&gt; type=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"&lt;br&gt;
System.ServiceModel.Activation.ServiceHttpHandlerFactory,System.ServiceModel.Activation, 
&lt;br&gt;
Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;preCondition=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"integratedMode,runtimeVersionv4.0"&lt;/span&gt; /&amp;gt;&lt;/span&gt;&lt;/pre&gt;Funktioniert
auch wieder die Aktivierung vom WCF basierten REST Service.&lt;br&gt;
&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.dotnetnukeblog.de/aggbug.ashx?id=260f952d-8750-41fa-b925-d22dbaef7953" /&gt;</description>
      <category>.NET 4.0</category>
      <category>ASP.NET</category>
      <category>IIS</category>
      <category>WCF</category>
    </item>
    <item>
      <trackback:ping>http://www.dotnetnukeblog.de/Trackback.aspx?guid=98e6daf7-ef31-45b6-9932-33f4871139eb</trackback:ping>
      <pingback:server>http://www.dotnetnukeblog.de/pingback.aspx</pingback:server>
      <pingback:target>http://www.dotnetnukeblog.de/PermaLink,guid,98e6daf7-ef31-45b6-9932-33f4871139eb.aspx</pingback:target>
      <dc:creator>Daniel M</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">Im Augenblick entwickel ich eine Architektur
für eine WEB-API basierend auf der WCF. Als Grundlage habe ich das <a href="http://wcf.codeplex.com/">WCF
Http Projekt</a> (das auf Codeplex zu finde ist) genommen. Mir gefällt dort insbesondere
der Ansatz der <b>MediaTypeProcessor</b>, womit sich die Request- und Response-Formate
sehr schön beeinflussen lassen.<br /><br />
Ein wichtier Aspekt bei jeder Architektur ist das Thema Exceptionhandling. Leider
gibt es für das oben genannte Projekt noch keinen eigenen Exceptionhandler, der auch
die <b>MediaTypeProcessors </b>nutzt, um eine Exception im angeforderten Format zurück
zu geben. Das kann z.B. <b>XML</b>, <b>Json </b>aber theoretisch auch ein Bild oder
Wav Dateien sein. 
<br />
Daher habe ich heute mal einen Exceptionhandler geschrieben, der mit dem Projekt zusammenarbeitet.
Als Basis wird hierbei natürlich das Interface der WCF <b>IErrorHandler </b>genutzt
und eine generelle Basisimplementierung aus dem Projekt.<br /><br />
Ich bin noch nicht 100% glücklich mit der Lösung aber im Augenblick funktioniert das
so ganz gut. Werde die Implementierung auch auf Codeplex posten und hoffe dort vielleicht
weitern Input zu finden. Aber auch per E-Mail freue ich mich über konstruktive Beiträge!<br /><br />
Here we go:<br /><pre><span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;"><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">public</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">class</span> RESTMessageErrorHandler
: HttpMessageErrorHandler, IErrorHandler { <span style="color: Green; background-color: Transparent; font-family: Courier New; font-size: 11px;">//
Public Methods</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">#region</span> HandleError <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">public</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">override</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">bool</span> HandleError(
Exception error) { Logging.Error(<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"API
Exception"</span>, error); <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">return</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">true</span>;
} <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">#endregion</span><span style="color: Green; background-color: Transparent; font-family: Courier New; font-size: 11px;">//
Protected Methods</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">#region</span> ProvideResponse <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">protected</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">override</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">void</span> ProvideResponse(
Exception exception, Microsoft.Http.HttpResponseMessage response) { APIBaseException
apiException <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">null</span>; <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">if</span> (exception <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">is</span> APIBaseException)
apiException <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span> exception <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">as</span> APIBaseException; <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">else</span> apiException <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">new</span> APIBaseException(System.Net.HttpStatusCode.InternalServerError,<br />
  <span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"An
error has occured processing your request."</span>); var supportedMediaTypes <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">new</span> List&lt;<span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">string</span>&gt;();
var httpMessageProperty <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span> OperationContext.Current.<br />
IncomingMessageProperties[HttpMessageProperty.Name] 
<br /><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">as</span> HttpMessageProperty;
var httpRequest <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span> httpMessageProperty.Request <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">as</span> HttpRequestMessage;
var contentType <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span> httpRequest.Headers.ContentType;
var uriMatch <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span> httpRequest.Properties.First(<br />
p =&gt; p.GetType() == <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">typeof</span>(UriTemplateMatch)) <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">as</span> UriTemplateMatch;
var endpoint <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span> OperationContext.Current.Host.Description.Endpoints.Find(<br />
OperationContext.Current.EndpointDispatcher.EndpointAddress.Uri); var dispatchOperation <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span> OperationContext.Current.EndpointDispatcher.DispatchRuntime.<br />
Operations.Where(op =&gt; op.Name == uriMatch.Data).First(); var operationDescription <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span> endpoint.Contract.Operations.Find(dispatchOperation.Name); <span style="color: Green; background-color: Transparent; font-family: Courier New; font-size: 11px;">//get
the contenttype of the request</span> var httpBehavoir <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span> endpoint.Behaviors.Find&lt;HttpEndpointBehavior&gt;();
var processors <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span> httpBehavoir.GetResponseProcessors(<br />
operationDescription.ToHttpOperationDescription()).ToList&lt;Processor&gt;(); <span style="color: Green; background-color: Transparent; font-family: Courier New; font-size: 11px;">//Fallback
for empty contenttype</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">if</span> (<span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">string</span>.IsNullOrEmpty(contentType))
{ <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">foreach</span> (var
processor <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">in</span> processors)
{ var mediaTypeProcessor <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span> processor <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">as</span> MediaTypeProcessor; <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">if</span> (mediaTypeProcessor
== <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">null</span>) <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">continue</span>;
supportedMediaTypes.AddRange(mediaTypeProcessor.SupportedMediaTypes); } contentType <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span> ContentNegotiationHelper.GetBestMatch(httpRequest.Headers.Accept.ToString(),<br />
 supportedMediaTypes).MediaType; <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">if</span> (<span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">string</span>.IsNullOrEmpty(contentType))
contentType <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span><span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"text/plain"</span>;
} <span style="color: Green; background-color: Transparent; font-family: Courier New; font-size: 11px;">//set
http-header and status code</span> response.Headers.ContentType <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span> contentType;
response.StatusCode <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span> apiException.Status; <span style="color: Green; background-color: Transparent; font-family: Courier New; font-size: 11px;">//search
processor for the output-serialization</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">foreach</span> (var
processor <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">in</span> processors)
{ var mediaTypeProcessor <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span> processor <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">as</span> MediaTypeProcessor; <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">if</span> (mediaTypeProcessor
== <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">null</span>) <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">continue</span>; <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">if</span> (mediaTypeProcessor.SupportedMediaTypes.Contains&lt;<span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">string</span>&gt;(contentType))
{ response.Content <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span> HttpContent.Create(s
=&gt; mediaTypeProcessor.<br />
WriteToStream(<span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">new</span> APIExceptionContract(apiException),
s, httpRequest)); <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">break</span>;
} } <span style="color: Green; background-color: Transparent; font-family: Courier New; font-size: 11px;">//if
no processor found use plain text</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">if</span> (response.Content
== <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">null</span>)
response.Content <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span> HttpContent.Create(apiException.Description);
} <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">#endregion</span> }</span></pre><br /><br /><p></p><img width="0" height="0" src="http://www.dotnetnukeblog.de/aggbug.ashx?id=98e6daf7-ef31-45b6-9932-33f4871139eb" /></body>
      <title>WCF Http API REST XML Custom ErrorHandler</title>
      <guid isPermaLink="false">http://www.dotnetnukeblog.de/PermaLink,guid,98e6daf7-ef31-45b6-9932-33f4871139eb.aspx</guid>
      <link>http://www.dotnetnukeblog.de/WCF+Http+API+REST+XML+Custom+ErrorHandler.aspx</link>
      <pubDate>Fri, 07 Jan 2011 13:59:38 GMT</pubDate>
      <description>Im Augenblick entwickel ich eine Architektur für eine WEB-API basierend auf der WCF. Als Grundlage habe ich das &lt;a href="http://wcf.codeplex.com/"&gt;WCF
Http Projekt&lt;/a&gt; (das auf Codeplex zu finde ist) genommen. Mir gefällt dort insbesondere
der Ansatz der &lt;b&gt;MediaTypeProcessor&lt;/b&gt;, womit sich die Request- und Response-Formate
sehr schön beeinflussen lassen.&lt;br&gt;
&lt;br&gt;
Ein wichtier Aspekt bei jeder Architektur ist das Thema Exceptionhandling. Leider
gibt es für das oben genannte Projekt noch keinen eigenen Exceptionhandler, der auch
die &lt;b&gt;MediaTypeProcessors &lt;/b&gt;nutzt, um eine Exception im angeforderten Format zurück
zu geben. Das kann z.B. &lt;b&gt;XML&lt;/b&gt;, &lt;b&gt;Json &lt;/b&gt;aber theoretisch auch ein Bild oder
Wav Dateien sein. 
&lt;br&gt;
Daher habe ich heute mal einen Exceptionhandler geschrieben, der mit dem Projekt zusammenarbeitet.
Als Basis wird hierbei natürlich das Interface der WCF &lt;b&gt;IErrorHandler &lt;/b&gt;genutzt
und eine generelle Basisimplementierung aus dem Projekt.&lt;br&gt;
&lt;br&gt;
Ich bin noch nicht 100% glücklich mit der Lösung aber im Augenblick funktioniert das
so ganz gut. Werde die Implementierung auch auf Codeplex posten und hoffe dort vielleicht
weitern Input zu finden. Aber auch per E-Mail freue ich mich über konstruktive Beiträge!&lt;br&gt;
&lt;br&gt;
Here we go:&lt;br&gt;
&lt;pre&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;public&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;class&lt;/span&gt; RESTMessageErrorHandler
: HttpMessageErrorHandler, IErrorHandler { &lt;span style="color: Green; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;//
Public Methods&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;#region&lt;/span&gt; HandleError &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;public&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;override&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;bool&lt;/span&gt; HandleError(
Exception error) { Logging.Error(&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"API
Exception"&lt;/span&gt;, error); &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;return&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;true&lt;/span&gt;;
} &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;#endregion&lt;/span&gt; &lt;span style="color: Green; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;//
Protected Methods&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;#region&lt;/span&gt; ProvideResponse &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;protected&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;override&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;void&lt;/span&gt; ProvideResponse(
Exception exception, Microsoft.Http.HttpResponseMessage response) { APIBaseException
apiException &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;null&lt;/span&gt;; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;if&lt;/span&gt; (exception &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;is&lt;/span&gt; APIBaseException)
apiException &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; exception &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;as&lt;/span&gt; APIBaseException; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;else&lt;/span&gt; apiException &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;new&lt;/span&gt; APIBaseException(System.Net.HttpStatusCode.InternalServerError,&lt;br&gt;
&amp;nbsp; &lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"An
error has occured processing your request."&lt;/span&gt;); var supportedMediaTypes &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;new&lt;/span&gt; List&amp;lt;&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;string&lt;/span&gt;&amp;gt;();
var httpMessageProperty &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; OperationContext.Current.&lt;br&gt;
IncomingMessageProperties[HttpMessageProperty.Name] 
&lt;br&gt;
&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;as&lt;/span&gt; HttpMessageProperty;
var httpRequest &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; httpMessageProperty.Request &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;as&lt;/span&gt; HttpRequestMessage;
var contentType &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; httpRequest.Headers.ContentType;
var uriMatch &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; httpRequest.Properties.First(&lt;br&gt;
p =&amp;gt; p.GetType() == &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;typeof&lt;/span&gt;(UriTemplateMatch)) &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;as&lt;/span&gt; UriTemplateMatch;
var endpoint &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; OperationContext.Current.Host.Description.Endpoints.Find(&lt;br&gt;
OperationContext.Current.EndpointDispatcher.EndpointAddress.Uri); var dispatchOperation &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; OperationContext.Current.EndpointDispatcher.DispatchRuntime.&lt;br&gt;
Operations.Where(op =&amp;gt; op.Name == uriMatch.Data).First(); var operationDescription &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; endpoint.Contract.Operations.Find(dispatchOperation.Name); &lt;span style="color: Green; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;//get
the contenttype of the request&lt;/span&gt; var httpBehavoir &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; endpoint.Behaviors.Find&amp;lt;HttpEndpointBehavior&amp;gt;();
var processors &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; httpBehavoir.GetResponseProcessors(&lt;br&gt;
operationDescription.ToHttpOperationDescription()).ToList&amp;lt;Processor&amp;gt;(); &lt;span style="color: Green; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;//Fallback
for empty contenttype&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;if&lt;/span&gt; (&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;string&lt;/span&gt;.IsNullOrEmpty(contentType))
{ &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;foreach&lt;/span&gt; (var
processor &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;in&lt;/span&gt; processors)
{ var mediaTypeProcessor &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; processor &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;as&lt;/span&gt; MediaTypeProcessor; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;if&lt;/span&gt; (mediaTypeProcessor
== &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;null&lt;/span&gt;) &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;continue&lt;/span&gt;;
supportedMediaTypes.AddRange(mediaTypeProcessor.SupportedMediaTypes); } contentType &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; ContentNegotiationHelper.GetBestMatch(httpRequest.Headers.Accept.ToString(),&lt;br&gt;
&amp;nbsp;supportedMediaTypes).MediaType; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;if&lt;/span&gt; (&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;string&lt;/span&gt;.IsNullOrEmpty(contentType))
contentType &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; &lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"text/plain"&lt;/span&gt;;
} &lt;span style="color: Green; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;//set
http-header and status code&lt;/span&gt; response.Headers.ContentType &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; contentType;
response.StatusCode &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; apiException.Status; &lt;span style="color: Green; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;//search
processor for the output-serialization&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;foreach&lt;/span&gt; (var
processor &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;in&lt;/span&gt; processors)
{ var mediaTypeProcessor &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; processor &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;as&lt;/span&gt; MediaTypeProcessor; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;if&lt;/span&gt; (mediaTypeProcessor
== &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;null&lt;/span&gt;) &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;continue&lt;/span&gt;; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;if&lt;/span&gt; (mediaTypeProcessor.SupportedMediaTypes.Contains&amp;lt;&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;string&lt;/span&gt;&amp;gt;(contentType))
{ response.Content &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; HttpContent.Create(s
=&amp;gt; mediaTypeProcessor.&lt;br&gt;
WriteToStream(&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;new&lt;/span&gt; APIExceptionContract(apiException),
s, httpRequest)); &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;break&lt;/span&gt;;
} } &lt;span style="color: Green; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;//if
no processor found use plain text&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;if&lt;/span&gt; (response.Content
== &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;null&lt;/span&gt;)
response.Content &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; HttpContent.Create(apiException.Description);
} &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;#endregion&lt;/span&gt; }&lt;/span&gt;&lt;/pre&gt;
&lt;br&gt;
&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.dotnetnukeblog.de/aggbug.ashx?id=98e6daf7-ef31-45b6-9932-33f4871139eb" /&gt;</description>
      <category>.NET 4.0</category>
      <category>ASP.NET</category>
      <category>WCF</category>
    </item>
    <item>
      <trackback:ping>http://www.dotnetnukeblog.de/Trackback.aspx?guid=648089bf-ab73-4883-9213-cc44818a37df</trackback:ping>
      <pingback:server>http://www.dotnetnukeblog.de/pingback.aspx</pingback:server>
      <pingback:target>http://www.dotnetnukeblog.de/PermaLink,guid,648089bf-ab73-4883-9213-cc44818a37df.aspx</pingback:target>
      <dc:creator>Daniel M</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">Bei der Umstellung eines ASP.NET Projektes
auf das <b>Framework 4.0</b> wurde bei bestimmten Eingabedaten immer der Fehler geworfen:<br /><br />
System.Web.<b>HttpRequestValidationException </b>(0x80004005): A potentially dangerous
Request.Form value was detected from the client (_dataTextBox="...bitkarte (&lt;print
template="pay...").<br />
   at System.Web.HttpRequest.ValidateString(String value, String collectionKey,
RequestValidationSource requestCollection)<br />
   at System.Web.HttpRequest.ValidateNameValueCollection(NameValueCollection
nvc, RequestValidationSource requestCollection)<br />
   at System.Web.HttpRequest.get_Form()<br /><br />
Dieses konnte man unter <b>ASP.NET 2.0 </b>durch ein <i>@pagedirektive</i> unterdrücken
bzw. die Filterung ausschalten. Bei <b>ASP.NET 4.0</b> ist dieses per @pagedirektive
aber nicht mehr per Default möglich, es gibt aber die Möglichkeit die RequestValidierung
per Eintrag in die web.config wieder in den Modus "ASP.NET 2.0" zu versetzen, damit
das Verhalten gleich bleibt. 
<br /><br />
Dafür ergänzt man die web.config wie folgt:<br /><br />
&lt;httpRuntime <b>requestValidationMode="2.0"</b> /&gt; 
<br /><br />
Weiter Informationen gibt es in der <a href="http://msdn.microsoft.com/de-de/library/system.web.configuration.httpruntimesection.requestvalidationmode.aspx" target="_blank">MSDN</a>.<br /><p></p><img width="0" height="0" src="http://www.dotnetnukeblog.de/aggbug.ashx?id=648089bf-ab73-4883-9213-cc44818a37df" /></body>
      <title>HttpRequestValidationException 0x80004005 A potentially dangerous Request.Form value was detected from the client</title>
      <guid isPermaLink="false">http://www.dotnetnukeblog.de/PermaLink,guid,648089bf-ab73-4883-9213-cc44818a37df.aspx</guid>
      <link>http://www.dotnetnukeblog.de/HttpRequestValidationException+0x80004005+A+Potentially+Dangerous+RequestForm+Value+Was+Detected+From+The+Client.aspx</link>
      <pubDate>Fri, 07 Jan 2011 08:44:20 GMT</pubDate>
      <description>Bei der Umstellung eines ASP.NET Projektes auf das &lt;b&gt;Framework 4.0&lt;/b&gt; wurde bei
bestimmten Eingabedaten immer der Fehler geworfen:&lt;br&gt;
&lt;br&gt;
System.Web.&lt;b&gt;HttpRequestValidationException &lt;/b&gt;(0x80004005): A potentially dangerous
Request.Form value was detected from the client (_dataTextBox="...bitkarte (&amp;lt;print
template="pay...").&lt;br&gt;
&amp;nbsp;&amp;nbsp; at System.Web.HttpRequest.ValidateString(String value, String collectionKey,
RequestValidationSource requestCollection)&lt;br&gt;
&amp;nbsp;&amp;nbsp; at System.Web.HttpRequest.ValidateNameValueCollection(NameValueCollection
nvc, RequestValidationSource requestCollection)&lt;br&gt;
&amp;nbsp;&amp;nbsp; at System.Web.HttpRequest.get_Form()&lt;br&gt;
&lt;br&gt;
Dieses konnte man unter &lt;b&gt;ASP.NET 2.0 &lt;/b&gt;durch ein &lt;i&gt;@pagedirektive&lt;/i&gt; unterdrücken
bzw. die Filterung ausschalten. Bei &lt;b&gt;ASP.NET 4.0&lt;/b&gt; ist dieses per @pagedirektive
aber nicht mehr per Default möglich, es gibt aber die Möglichkeit die RequestValidierung
per Eintrag in die web.config wieder in den Modus "ASP.NET 2.0" zu versetzen, damit
das Verhalten gleich bleibt. 
&lt;br&gt;
&lt;br&gt;
Dafür ergänzt man die web.config wie folgt:&lt;br&gt;
&lt;br&gt;
&amp;lt;httpRuntime &lt;b&gt;requestValidationMode="2.0"&lt;/b&gt; /&amp;gt; 
&lt;br&gt;
&lt;br&gt;
Weiter Informationen gibt es in der &lt;a href="http://msdn.microsoft.com/de-de/library/system.web.configuration.httpruntimesection.requestvalidationmode.aspx" target="_blank"&gt;MSDN&lt;/a&gt;.&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.dotnetnukeblog.de/aggbug.ashx?id=648089bf-ab73-4883-9213-cc44818a37df" /&gt;</description>
      <category>.NET 2.0</category>
      <category>ASP.NET</category>
      <category>.NET 4.0</category>
    </item>
    <item>
      <trackback:ping>http://www.dotnetnukeblog.de/Trackback.aspx?guid=730d0c3c-c3ee-4b99-b37d-39ca249e0f62</trackback:ping>
      <pingback:server>http://www.dotnetnukeblog.de/pingback.aspx</pingback:server>
      <pingback:target>http://www.dotnetnukeblog.de/PermaLink,guid,730d0c3c-c3ee-4b99-b37d-39ca249e0f62.aspx</pingback:target>
      <dc:creator>Daniel M</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">Bei dem IIS 7.5 hatte ich gerade das Problem,
dass eine Url die <b>Whitespaces </b>als "<b>+</b>" codiert (auch wenn es nicht optimal
ist aber leider nicht zu ändern aktuell) immer mit dem Fehler <b>http</b> Statuscode <b>404.11</b> und
der Nachricht <b>The request filtering module is configured to deny a request that
contains a double escape sequence.</b> beendet wurde. 
<br /><br />
Der Grund für die Ablenung der Url ist, dass "+" als ein gefährliches Zeichen eingestuft
wird. Hierbei handelt es sich also um eine Sicherheitseinstellung.<br /><br />
Wenn man nun solche Urls aber weiter verarbeiten möchte, dann kann man diesen Requestfilter
einfach deaktivieren über folgenden Aufruf:<br /><br /><i>%windir%System32\inetsrv&gt;appcmd set config -section:system.webServer/security/requestfiltering
-allowDoubleEscaping:true</i><br /><br />
Weitere Informationen zum RequestFiltering gibt es auch hier <a href="http://www.iis.net/ConfigReference/system.webServer/security/requestFiltering">IIS
Security RequestFiltering</a>.<br /><br /><br /><p></p><img width="0" height="0" src="http://www.dotnetnukeblog.de/aggbug.ashx?id=730d0c3c-c3ee-4b99-b37d-39ca249e0f62" /></body>
      <title>HTTP Error 404.11 IIS7 verarbeitet keine URLs mit + </title>
      <guid isPermaLink="false">http://www.dotnetnukeblog.de/PermaLink,guid,730d0c3c-c3ee-4b99-b37d-39ca249e0f62.aspx</guid>
      <link>http://www.dotnetnukeblog.de/HTTP+Error+40411+IIS7+Verarbeitet+Keine+URLs+Mit.aspx</link>
      <pubDate>Wed, 05 Jan 2011 17:17:50 GMT</pubDate>
      <description>Bei dem IIS 7.5 hatte ich gerade das Problem, dass eine Url die &lt;b&gt;Whitespaces &lt;/b&gt;als
"&lt;b&gt;+&lt;/b&gt;" codiert (auch wenn es nicht optimal ist aber leider nicht zu ändern aktuell)
immer mit dem Fehler &lt;b&gt;http&lt;/b&gt; Statuscode &lt;b&gt;404.11&lt;/b&gt; und der Nachricht &lt;b&gt;The
request filtering module is configured to deny a request that contains a double escape
sequence.&lt;/b&gt; beendet wurde. 
&lt;br&gt;
&lt;br&gt;
Der Grund für die Ablenung der Url ist, dass "+" als ein gefährliches Zeichen eingestuft
wird. Hierbei handelt es sich also um eine Sicherheitseinstellung.&lt;br&gt;
&lt;br&gt;
Wenn man nun solche Urls aber weiter verarbeiten möchte, dann kann man diesen Requestfilter
einfach deaktivieren über folgenden Aufruf:&lt;br&gt;
&lt;br&gt;
&lt;i&gt;%windir%System32\inetsrv&amp;gt;appcmd set config -section:system.webServer/security/requestfiltering
-allowDoubleEscaping:true&lt;/i&gt;
&lt;br&gt;
&lt;br&gt;
Weitere Informationen zum RequestFiltering gibt es auch hier &lt;a href="http://www.iis.net/ConfigReference/system.webServer/security/requestFiltering"&gt;IIS
Security RequestFiltering&lt;/a&gt;.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.dotnetnukeblog.de/aggbug.ashx?id=730d0c3c-c3ee-4b99-b37d-39ca249e0f62" /&gt;</description>
      <category>ASP.NET</category>
      <category>IIS</category>
    </item>
    <item>
      <trackback:ping>http://www.dotnetnukeblog.de/Trackback.aspx?guid=02b7953e-0e3a-46bd-9d05-fdf01a7bc9c0</trackback:ping>
      <pingback:server>http://www.dotnetnukeblog.de/pingback.aspx</pingback:server>
      <pingback:target>http://www.dotnetnukeblog.de/PermaLink,guid,02b7953e-0e3a-46bd-9d05-fdf01a7bc9c0.aspx</pingback:target>
      <dc:creator>Daniel M</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">In einer Evaluierungsphase habe ich gerade
mal probiert eine alte <b>ASP.Net 1.1</b> Anwendung auf einem Windows Server 2008
zu installieren. Per Default wird allerdings ASP.NET 1.1 nicht mehr auf einem Windows
2008 Server unterstützt, so das ein wenig manuelle Arbeit notwendig ist.<br /><br />
Als erstes muss man die "<b>IIS Metabase Compatibility</b>" installieren und das geht
durch die Schritte: "Start" -&gt; "Server Manager" -&gt;  "Manage Roles" -&gt;
"Web Server (IIS)" -&gt; "Add Role Services".  
<br /><br />
Der zweite Schritt ist die Installation vom .Net Framework 1.1. Hier die Downloadlinks:<br /><br /><a href="http://www.microsoft.com/downloads/info.aspx?na=22&amp;p=1&amp;SrcDisplayLang=en&amp;SrcCategoryId=&amp;SrcFamilyId=&amp;u=%2fdownloads%2fdetails.aspx%3fFamilyID%3d262d25e3-f589-4842-8157-034d1e7cf3a3%26DisplayLang%3den">.NET
Framework Version 1.1 Redistributable Package</a><br /><a href="http://www.microsoft.com/downloads/info.aspx?na=22&amp;p=3&amp;SrcDisplayLang=en&amp;SrcCategoryId=&amp;SrcFamilyId=&amp;u=%2fdownloads%2fdetails.aspx%3fFamilyID%3da8f5654f-088e-40b2-bbdb-a83353618b38%26DisplayLang%3den">.NET
Framework Version 1.1 Service Pack 1</a><br /><a href="http://www.microsoft.com/downloads/info.aspx?na=22&amp;p=7&amp;SrcDisplayLang=en&amp;SrcCategoryId=&amp;SrcFamilyId=&amp;u=%2fdownloads%2fdetails.aspx%3fFamilyID%3d8ec6fb8a-29eb-49cf-9dbc-1a0dc2273ff9%26DisplayLang%3den">ASP.NET
Security Update for .NET Framework 1.1 SP1</a><br /><br />
Wenn man das Setup ausführt, dann bekommt man vom Windows Server 2008 den Hinweis
das es möglicherweise Kompatibilitätsprobleme geben könnte. Diese Meldung einfach
mit "Ausführen" / "run programm" überspringen.<br /><br />
Anschließend muss das alte .Net Framework noch im IIS registriert werden. Dafür kann
man folgenden Behfel ausführen:<br /><br /><i>%windir%\Microsoft.NET\Framework\v1.1.4322\aspnet_regiis -enable</i><br /><br />
Ein Änderung in der <b>machine.config</b> (unter %windir%\Microsoft.NET\Framework\v1.1.4322\config\machine.config)
muss noch gemacht werden. Vor dem schließenden Tag &lt;/configSection&gt; muss folgendes
hinzhugefügt werden:<br /><br />
&lt;section name="system.webServer" type="System.Configuration.IgnoreSectionHandler,<br />
    System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
/&gt;<br /><br />
Einen neue ApplicationPool - der unter .Net 1.1 läuft - kann man nun mit folgendem
Befehl anlegen:<br /><br /><i>%windir%\system32\inetsrv\appcmd add apppool /name:"Pool1-1"  /managedRuntimeVersion:"v1.1" </i><br /><br />
Bei einem <b>64bit </b>Betriebsystem muss man nun noch ein Verzeichnis erstellen:<br /><br /><i>md %windir%\Microsoft.net\Framework64\v1.1.4322\config </i><br />
und<br /><i>copy %windir%\Microsoft.net\Framework\v1.1.4322\Config\machine.config </i><i>%windir%\Microsoft.net\Framework64\v1.1.4322\config\machine.config</i><p></p><img width="0" height="0" src="http://www.dotnetnukeblog.de/aggbug.ashx?id=02b7953e-0e3a-46bd-9d05-fdf01a7bc9c0" /></body>
      <title>Install ASP.NET 1.1 with IIS7 on Windows 2008 </title>
      <guid isPermaLink="false">http://www.dotnetnukeblog.de/PermaLink,guid,02b7953e-0e3a-46bd-9d05-fdf01a7bc9c0.aspx</guid>
      <link>http://www.dotnetnukeblog.de/Install+ASPNET+11+With+IIS7+On+Windows+2008.aspx</link>
      <pubDate>Tue, 04 Jan 2011 12:54:47 GMT</pubDate>
      <description>In einer Evaluierungsphase habe ich gerade mal probiert eine alte &lt;b&gt;ASP.Net 1.1&lt;/b&gt; Anwendung
auf einem Windows Server 2008 zu installieren. Per Default wird allerdings ASP.NET
1.1 nicht mehr auf einem Windows 2008 Server unterstützt, so das ein wenig manuelle
Arbeit notwendig ist.&lt;br&gt;
&lt;br&gt;
Als erstes muss man die "&lt;b&gt;IIS Metabase Compatibility&lt;/b&gt;" installieren und das geht
durch die Schritte: "Start" -&amp;gt; "Server Manager" -&amp;gt;&amp;nbsp; "Manage Roles" -&amp;gt;
"Web Server (IIS)" -&amp;gt; "Add Role Services".&amp;nbsp; 
&lt;br&gt;
&lt;br&gt;
Der zweite Schritt ist die Installation vom .Net Framework 1.1. Hier die Downloadlinks:&lt;br&gt;
&lt;br&gt;
&lt;a href="http://www.microsoft.com/downloads/info.aspx?na=22&amp;amp;p=1&amp;amp;SrcDisplayLang=en&amp;amp;SrcCategoryId=&amp;amp;SrcFamilyId=&amp;amp;u=%2fdownloads%2fdetails.aspx%3fFamilyID%3d262d25e3-f589-4842-8157-034d1e7cf3a3%26DisplayLang%3den"&gt;.NET
Framework Version 1.1 Redistributable Package&lt;/a&gt;
&lt;br&gt;
&lt;a href="http://www.microsoft.com/downloads/info.aspx?na=22&amp;amp;p=3&amp;amp;SrcDisplayLang=en&amp;amp;SrcCategoryId=&amp;amp;SrcFamilyId=&amp;amp;u=%2fdownloads%2fdetails.aspx%3fFamilyID%3da8f5654f-088e-40b2-bbdb-a83353618b38%26DisplayLang%3den"&gt;.NET
Framework Version 1.1 Service Pack 1&lt;/a&gt;
&lt;br&gt;
&lt;a href="http://www.microsoft.com/downloads/info.aspx?na=22&amp;amp;p=7&amp;amp;SrcDisplayLang=en&amp;amp;SrcCategoryId=&amp;amp;SrcFamilyId=&amp;amp;u=%2fdownloads%2fdetails.aspx%3fFamilyID%3d8ec6fb8a-29eb-49cf-9dbc-1a0dc2273ff9%26DisplayLang%3den"&gt;ASP.NET
Security Update for .NET Framework 1.1 SP1&lt;/a&gt;
&lt;br&gt;
&lt;br&gt;
Wenn man das Setup ausführt, dann bekommt man vom Windows Server 2008 den Hinweis
das es möglicherweise Kompatibilitätsprobleme geben könnte. Diese Meldung einfach
mit "Ausführen" / "run programm" überspringen.&lt;br&gt;
&lt;br&gt;
Anschließend muss das alte .Net Framework noch im IIS registriert werden. Dafür kann
man folgenden Behfel ausführen:&lt;br&gt;
&lt;br&gt;
&lt;i&gt;%windir%\Microsoft.NET\Framework\v1.1.4322\aspnet_regiis -enable&lt;/i&gt;
&lt;br&gt;
&lt;br&gt;
Ein Änderung in der &lt;b&gt;machine.config&lt;/b&gt; (unter %windir%\Microsoft.NET\Framework\v1.1.4322\config\machine.config)
muss noch gemacht werden. Vor dem schließenden Tag &amp;lt;/configSection&amp;gt; muss folgendes
hinzhugefügt werden:&lt;br&gt;
&lt;br&gt;
&amp;lt;section name="system.webServer" type="System.Configuration.IgnoreSectionHandler,&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
/&amp;gt;&lt;br&gt;
&lt;br&gt;
Einen neue ApplicationPool - der unter .Net 1.1 läuft - kann man nun mit folgendem
Befehl anlegen:&lt;br&gt;
&lt;br&gt;
&lt;i&gt;%windir%\system32\inetsrv\appcmd add apppool /name:"Pool1-1"&amp;nbsp; /managedRuntimeVersion:"v1.1" &lt;/i&gt;
&lt;br&gt;
&lt;br&gt;
Bei einem &lt;b&gt;64bit &lt;/b&gt;Betriebsystem muss man nun noch ein Verzeichnis erstellen:&lt;br&gt;
&lt;br&gt;
&lt;i&gt;md %windir%\Microsoft.net\Framework64\v1.1.4322\config &lt;/i&gt;
&lt;br&gt;
und&lt;br&gt;
&lt;i&gt;copy %windir%\Microsoft.net\Framework\v1.1.4322\Config\machine.config &lt;/i&gt;&lt;i&gt;%windir%\Microsoft.net\Framework64\v1.1.4322\config\machine.config&lt;/i&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.dotnetnukeblog.de/aggbug.ashx?id=02b7953e-0e3a-46bd-9d05-fdf01a7bc9c0" /&gt;</description>
      <category>.NET</category>
      <category>ASP.NET</category>
      <category>IIS</category>
    </item>
    <item>
      <trackback:ping>http://www.dotnetnukeblog.de/Trackback.aspx?guid=bde7b0e2-c3f9-4144-9cfb-82d8005b7cb5</trackback:ping>
      <pingback:server>http://www.dotnetnukeblog.de/pingback.aspx</pingback:server>
      <pingback:target>http://www.dotnetnukeblog.de/PermaLink,guid,bde7b0e2-c3f9-4144-9cfb-82d8005b7cb5.aspx</pingback:target>
      <dc:creator>Daniel M</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">Heute habe ich versucht bei mir lokal ein
SSL Zertifikat zu installieren. So etwas habe ich nicht zum ersten mal gemacht aber
heute wollte es einfach nicht funktionieren. Immer wenn ich den IIS entsprechend konfiguriert
hatte (Zertifikat importiert, Binding bzw. Hostheader erstellt, etc.) kam beim Versuch
den IIS zu starten immer die Meldung:<br /><br /><b>IIS Manager Error: The process cannot access the file because it is being used
by another process. (Exception from HRESULT: 0×80070020)<br /></b><br />
Nach der Analyse habe ich dann festgestellt, dass ein Prozess bereits den Port <b>443 </b>nutzt
und daher der IIS mit einem <b>https</b>-Binding natürlich nicht mehr richtig starten
konnte. Herausfinden welcher Port aktuell genutzt wird kann man im übrigen über "netstart
-ano" im Cmd-Prompt. Der Befehl "Tasklist" hat mir dann den notwendigen Hinweis gegeben. <b>Skype </b>ist
der "Bösewicht" der den Port <b>443 </b>nutzt. Dieses kann man aber per Konfiguration
ausschalten. 
<br /><br />
Danach funktioniert auch der Start vom <b>IIS </b>mit einem <b>htts</b>-Binding<br /><br /><br /><br /><p></p><img width="0" height="0" src="http://www.dotnetnukeblog.de/aggbug.ashx?id=bde7b0e2-c3f9-4144-9cfb-82d8005b7cb5" /></body>
      <title>IIS Manager Error: The process cannot access the file because it is being used by another process. (Exception from HRESULT: 0×80070020)</title>
      <guid isPermaLink="false">http://www.dotnetnukeblog.de/PermaLink,guid,bde7b0e2-c3f9-4144-9cfb-82d8005b7cb5.aspx</guid>
      <link>http://www.dotnetnukeblog.de/IIS+Manager+Error+The+Process+Cannot+Access+The+File+Because+It+Is+Being+Used+By+Another+Process+Exception+From+HRESULT+080070020.aspx</link>
      <pubDate>Thu, 30 Dec 2010 10:31:54 GMT</pubDate>
      <description>Heute habe ich versucht bei mir lokal ein SSL Zertifikat zu installieren. So etwas habe ich nicht zum ersten mal gemacht aber heute wollte es einfach nicht funktionieren. Immer wenn ich den IIS entsprechend konfiguriert hatte (Zertifikat importiert, Binding bzw. Hostheader erstellt, etc.) kam beim Versuch den IIS zu starten immer die Meldung:&lt;br&gt;
&lt;br&gt;
&lt;b&gt;IIS Manager Error: The process cannot access the file because it is being used
by another process. (Exception from HRESULT: 0×80070020)&lt;br&gt;
&lt;/b&gt;
&lt;br&gt;
Nach der Analyse habe ich dann festgestellt, dass ein Prozess bereits den Port &lt;b&gt;443 &lt;/b&gt;nutzt
und daher der IIS mit einem &lt;b&gt;https&lt;/b&gt;-Binding natürlich nicht mehr richtig starten
konnte. Herausfinden welcher Port aktuell genutzt wird kann man im übrigen über "netstart
-ano" im Cmd-Prompt. Der Befehl "Tasklist" hat mir dann den notwendigen Hinweis gegeben. &lt;b&gt;Skype &lt;/b&gt;ist
der "Bösewicht" der den Port &lt;b&gt;443 &lt;/b&gt;nutzt. Dieses kann man aber per Konfiguration
ausschalten. 
&lt;br&gt;
&lt;br&gt;
Danach funktioniert auch der Start vom &lt;b&gt;IIS &lt;/b&gt;mit einem &lt;b&gt;htts&lt;/b&gt;-Binding&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.dotnetnukeblog.de/aggbug.ashx?id=bde7b0e2-c3f9-4144-9cfb-82d8005b7cb5" /&gt;</description>
      <category>Allgemein</category>
      <category>IIS</category>
    </item>
    <item>
      <trackback:ping>http://www.dotnetnukeblog.de/Trackback.aspx?guid=cbb34ee9-88c1-4bff-bd50-5d53418a83af</trackback:ping>
      <pingback:server>http://www.dotnetnukeblog.de/pingback.aspx</pingback:server>
      <pingback:target>http://www.dotnetnukeblog.de/PermaLink,guid,cbb34ee9-88c1-4bff-bd50-5d53418a83af.aspx</pingback:target>
      <dc:creator>Daniel M</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">Bei dem Standardverhalten, wenn ein <b>WCF
Service</b> über den IIS veröffentlicht wird ist, dass der Endpunkt die Datei von
Service ist mit der Dateiendung "<b>.svc</b>". Dieses sieht aber - gerade im Bezug
auf ein <b>REST-basiertes</b> System nicht besonders elegant aus. 
<br /><br />
Bei dem Einsatz von <b>IIS 7.0</b> ist es sehr einfach die Dateiendung zu entfernen,
ohne dabei viel Code zu schreiben. Für das <b>URL Rewriting</b> gibt eine Erweiterung,
die man dem IIS 7.0 hinzufügen kann. Dadurch ist es sehr schön möglich z.B. über Regular
Expressions ein URL Rewriting durchzuführen. 
<br /><br />
Nach der Installation dieser <a href="http://www.iis.net/downloads/default.aspx?tabid=34&amp;g=6&amp;i=1691">Erweiterung</a> muss
nur noch folgende Regel definiert werden:<br /><br />
1. Name: <i>Entfernen der Dateiendung svc</i><br />
2. Request URL: <i>Matches the pattern</i><br />
3. Using: <i>Regular Expressions</i><br />
4. Pattern: <i>^([0-9a-zA-Z\-]+)/([0-9a-zA-Z\-\.\/\(\)]+) </i><br />
5. Ignore Cases: <i>true</i><br />
6. Action Type: <i>Rewrite</i><br />
7. Rewrite URL: <i>{R:1}.svc/{R:2}</i><br />
8. Append Querystring: <i>true</i><br /><br />
Fertig ;-)<br /><br />
Per Eintrag in der web.config sieht das dann alternativ so aus:<br /><br />
  &lt;system.webServer&gt;<br />
    &lt;modules runAllManagedModulesForAllRequests="true" /&gt;<br />
        &lt;rewrite&gt;<br />
            &lt;rules&gt;<br />
               
&lt;rule name="Remove Svc Extension"&gt;<br />
                   
&lt;match url="^([0-9a-zA-Z\-]+)/([0-9a-zA-Z\-\.\/\(\)]+)" /&gt;<br />
                   
&lt;action type="Rewrite" url="{R:1}.svc/{R:2}" /&gt;<br />
               
&lt;/rule&gt;<br />
            &lt;/rules&gt;<br />
        &lt;/rewrite&gt;<br />
  &lt;/system.webServer&gt;<br /><br /><p></p><img width="0" height="0" src="http://www.dotnetnukeblog.de/aggbug.ashx?id=cbb34ee9-88c1-4bff-bd50-5d53418a83af" /></body>
      <title>WCF URL Rewriting entfernen der Endung "svc"</title>
      <guid isPermaLink="false">http://www.dotnetnukeblog.de/PermaLink,guid,cbb34ee9-88c1-4bff-bd50-5d53418a83af.aspx</guid>
      <link>http://www.dotnetnukeblog.de/WCF+URL+Rewriting+Entfernen+Der+Endung+Svc.aspx</link>
      <pubDate>Tue, 26 Oct 2010 12:21:09 GMT</pubDate>
      <description>Bei dem Standardverhalten, wenn ein &lt;b&gt;WCF Service&lt;/b&gt; über den IIS veröffentlicht
wird ist, dass der Endpunkt die Datei von Service ist mit der Dateiendung "&lt;b&gt;.svc&lt;/b&gt;".
Dieses sieht aber - gerade im Bezug auf ein &lt;b&gt;REST-basiertes&lt;/b&gt; System nicht besonders
elegant aus. 
&lt;br&gt;
&lt;br&gt;
Bei dem Einsatz von &lt;b&gt;IIS 7.0&lt;/b&gt; ist es sehr einfach die Dateiendung zu entfernen,
ohne dabei viel Code zu schreiben. Für das &lt;b&gt;URL Rewriting&lt;/b&gt; gibt eine Erweiterung,
die man dem IIS 7.0 hinzufügen kann. Dadurch ist es sehr schön möglich z.B. über Regular
Expressions ein URL Rewriting durchzuführen. 
&lt;br&gt;
&lt;br&gt;
Nach der Installation dieser &lt;a href="http://www.iis.net/downloads/default.aspx?tabid=34&amp;amp;g=6&amp;amp;i=1691"&gt;Erweiterung&lt;/a&gt; muss
nur noch folgende Regel definiert werden:&lt;br&gt;
&lt;br&gt;
1. Name: &lt;i&gt;Entfernen der Dateiendung svc&lt;/i&gt;
&lt;br&gt;
2. Request URL: &lt;i&gt;Matches the pattern&lt;/i&gt;
&lt;br&gt;
3. Using: &lt;i&gt;Regular Expressions&lt;/i&gt;
&lt;br&gt;
4. Pattern: &lt;i&gt;^([0-9a-zA-Z\-]+)/([0-9a-zA-Z\-\.\/\(\)]+) &lt;/i&gt;
&lt;br&gt;
5. Ignore Cases: &lt;i&gt;true&lt;/i&gt;
&lt;br&gt;
6. Action Type: &lt;i&gt;Rewrite&lt;/i&gt;
&lt;br&gt;
7. Rewrite URL: &lt;i&gt;{R:1}.svc/{R:2}&lt;/i&gt;
&lt;br&gt;
8. Append Querystring: &lt;i&gt;true&lt;/i&gt;
&lt;br&gt;
&lt;br&gt;
Fertig ;-)&lt;br&gt;
&lt;br&gt;
Per Eintrag in der web.config sieht das dann alternativ so aus:&lt;br&gt;
&lt;br&gt;
&amp;nbsp; &amp;lt;system.webServer&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;modules runAllManagedModulesForAllRequests="true" /&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;rewrite&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;rules&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;lt;rule name="Remove Svc Extension"&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;lt;match url="^([0-9a-zA-Z\-]+)/([0-9a-zA-Z\-\.\/\(\)]+)" /&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;lt;action type="Rewrite" url="{R:1}.svc/{R:2}" /&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;lt;/rule&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/rules&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/rewrite&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;/system.webServer&amp;gt;&lt;br&gt;
&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.dotnetnukeblog.de/aggbug.ashx?id=cbb34ee9-88c1-4bff-bd50-5d53418a83af" /&gt;</description>
      <category>.NET</category>
      <category>ASP.NET</category>
      <category>IIS</category>
      <category>WCF</category>
    </item>
    <item>
      <trackback:ping>http://www.dotnetnukeblog.de/Trackback.aspx?guid=aa3faa12-4113-42b7-b8a6-d7173b2fe023</trackback:ping>
      <pingback:server>http://www.dotnetnukeblog.de/pingback.aspx</pingback:server>
      <pingback:target>http://www.dotnetnukeblog.de/PermaLink,guid,aa3faa12-4113-42b7-b8a6-d7173b2fe023.aspx</pingback:target>
      <dc:creator>Daniel M</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">Jeder Webservice sollte einen eindeutigen
Namespace verwenden, um im Web auf jeden Fall eindeutig zu sein. Als Standardnamespace
wird von ASP.NET Webservices (und auch von der WCF) folgender Namespace verwendet: <b>http://tempuri.org</b><br />
Dieses sollte als erstes modifiziert werden, damit man erst gar nicht mit einem solchen
Namespace online geht.<br /><br />
Das Problem bei der WCF ist nun leider, dass der Namespace an drei verschiedenen Stellen
angegeben werden muss, damit auch im WSDL der gewünschte Namespace durchgängig verwendet
wird.<br /><br />
Als erstes muss man dem Namespace beim der Servicebeschreibung dem [<b>ServiceContract</b>]
angeben:<span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;"><br /><br />
[ServiceContract(Namespace <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span><span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"http://dotnetnukeblog.de"</span>)] 
<br /><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">public</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">interface</span> IPostService</span><br /><br /><br /><br />
Die zweite Stelle ist bei der <b>Serviceimplementierung</b><span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;">:<br /><br />
[ServiceBehavior(Namespace <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span><span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"http://dotnetnukeblog.de"</span>)] 
<br /><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">class</span> PostService
: IPostService </span><br /><br />
Die letzte Stelle ist bei der Konfiguration des <b>Endpoints </b>mit dem Attribute <b>bindingNamespace</b>:<br /><br /><span style="font-family: courier new;"><span style="color: rgb(51, 51, 255);">&lt;</span><span style="color: rgb(153, 51, 0);">endpoint</span><span style="color: rgb(255, 0, 0);">binding</span><span style="color: rgb(51, 51, 255);">="basicHttpBinding"</span><br /><span style="color: rgb(255, 0, 0);">bindingNamespace</span>=<span style="color: rgb(51, 51, 255);">"http://dotnetnukeblog.de"</span>....</span><br /><br />
Erst wenn an allen drei Stellen der Namespace gesetzt wurde, wird dieser auch durchgängig
bei der WSDL Erzeugung genutzt.<br /><br /><br /><p></p><img width="0" height="0" src="http://www.dotnetnukeblog.de/aggbug.ashx?id=aa3faa12-4113-42b7-b8a6-d7173b2fe023" /></body>
      <title>WCF WSDL replace http://tempuri.org </title>
      <guid isPermaLink="false">http://www.dotnetnukeblog.de/PermaLink,guid,aa3faa12-4113-42b7-b8a6-d7173b2fe023.aspx</guid>
      <link>http://www.dotnetnukeblog.de/WCF+WSDL+Replace+Httptempuriorg.aspx</link>
      <pubDate>Tue, 26 Oct 2010 09:48:45 GMT</pubDate>
      <description>Jeder Webservice sollte einen eindeutigen Namespace verwenden, um im Web auf jeden Fall eindeutig zu sein. Als Standardnamespace wird von ASP.NET Webservices (und auch von der WCF) folgender Namespace verwendet: &lt;b&gt;http://tempuri.org&lt;/b&gt;
&lt;br&gt;
Dieses sollte als erstes modifiziert werden, damit man erst gar nicht mit einem solchen
Namespace online geht.&lt;br&gt;
&lt;br&gt;
Das Problem bei der WCF ist nun leider, dass der Namespace an drei verschiedenen Stellen
angegeben werden muss, damit auch im WSDL der gewünschte Namespace durchgängig verwendet
wird.&lt;br&gt;
&lt;br&gt;
Als erstes muss man dem Namespace beim der Servicebeschreibung dem [&lt;b&gt;ServiceContract&lt;/b&gt;]
angeben:&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;
&lt;br&gt;
&lt;br&gt;
[ServiceContract(Namespace &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; &lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"http://dotnetnukeblog.de"&lt;/span&gt;)] 
&lt;br&gt;
&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;public&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;interface&lt;/span&gt; IPostService&lt;/span&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Die zweite Stelle ist bei der &lt;b&gt;Serviceimplementierung&lt;/b&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;:&lt;br&gt;
&lt;br&gt;
[ServiceBehavior(Namespace &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; &lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"http://dotnetnukeblog.de"&lt;/span&gt;)] 
&lt;br&gt;
&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;class&lt;/span&gt; PostService
: IPostService &lt;/span&gt;
&lt;br&gt;
&lt;br&gt;
Die letzte Stelle ist bei der Konfiguration des &lt;b&gt;Endpoints &lt;/b&gt;mit dem Attribute &lt;b&gt;bindingNamespace&lt;/b&gt;:&lt;br&gt;
&lt;br&gt;
&lt;span style="font-family: courier new;"&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(153, 51, 0);"&gt;endpoint&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;binding&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;="basicHttpBinding"&lt;/span&gt; 
&lt;br&gt;
&lt;span style="color: rgb(255, 0, 0);"&gt;bindingNamespace&lt;/span&gt;=&lt;span style="color: rgb(51, 51, 255);"&gt;"http://dotnetnukeblog.de"&lt;/span&gt;....&lt;/span&gt; 
&lt;br&gt;
&lt;br&gt;
Erst wenn an allen drei Stellen der Namespace gesetzt wurde, wird dieser auch durchgängig
bei der WSDL Erzeugung genutzt.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.dotnetnukeblog.de/aggbug.ashx?id=aa3faa12-4113-42b7-b8a6-d7173b2fe023" /&gt;</description>
      <category>ASP.NET</category>
      <category>WCF</category>
    </item>
    <item>
      <trackback:ping>http://www.dotnetnukeblog.de/Trackback.aspx?guid=b8794060-fb15-4071-a259-947778e32b03</trackback:ping>
      <pingback:server>http://www.dotnetnukeblog.de/pingback.aspx</pingback:server>
      <pingback:target>http://www.dotnetnukeblog.de/PermaLink,guid,b8794060-fb15-4071-a259-947778e32b03.aspx</pingback:target>
      <dc:creator>Daniel M</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">Nachdem ich an einem jungfräulichen Rechner
sitze und gerade einen WCF Service debuggen wolte, bekam ich ständig vom IIS den Fehlercode <b>404.3</b>.
Schnell habe ich herausgefunden das die verwendete Endung "<b>.svc</b>" nicht einem
Handler zugeordnet ist. Um dieses aber nicht manuel machen zu müssen gibt es bei der
WCF ein Tool, dass die Registrierung übernimmt. 
<br /><br />
Das Tool findet man unter <b>%Windows%\Microsoft.Net\Framework\v3.0\Windows Communication
Foundation\ </b>und heißt <b>ServiceModelReg.exe</b>. Das muss mit dem Parameter "-i"
aufgerufen werden und anschließend funktioniert auch das Hosting im IIS.<br /><p></p><img width="0" height="0" src="http://www.dotnetnukeblog.de/aggbug.ashx?id=b8794060-fb15-4071-a259-947778e32b03" /></body>
      <title>WCF, IIS and 404.3 Errors</title>
      <guid isPermaLink="false">http://www.dotnetnukeblog.de/PermaLink,guid,b8794060-fb15-4071-a259-947778e32b03.aspx</guid>
      <link>http://www.dotnetnukeblog.de/WCF+IIS+And+4043+Errors.aspx</link>
      <pubDate>Wed, 20 Oct 2010 13:21:55 GMT</pubDate>
      <description>Nachdem ich an einem jungfräulichen Rechner sitze und gerade einen WCF Service debuggen wolte, bekam ich ständig vom IIS den Fehlercode &lt;b&gt;404.3&lt;/b&gt;.
Schnell habe ich herausgefunden das die verwendete Endung "&lt;b&gt;.svc&lt;/b&gt;" nicht einem
Handler zugeordnet ist. Um dieses aber nicht manuel machen zu müssen gibt es bei der
WCF ein Tool, dass die Registrierung übernimmt. 
&lt;br&gt;
&lt;br&gt;
Das Tool findet man unter &lt;b&gt;%Windows%\Microsoft.Net\Framework\v3.0\Windows Communication
Foundation\ &lt;/b&gt;und heißt &lt;b&gt;ServiceModelReg.exe&lt;/b&gt;. Das muss mit dem Parameter "-i"
aufgerufen werden und anschließend funktioniert auch das Hosting im IIS.&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.dotnetnukeblog.de/aggbug.ashx?id=b8794060-fb15-4071-a259-947778e32b03" /&gt;</description>
      <category>.NET</category>
      <category>ASP.NET</category>
      <category>WCF</category>
    </item>
    <item>
      <trackback:ping>http://www.dotnetnukeblog.de/Trackback.aspx?guid=0b204ade-d19a-4d08-b422-7bdc2ce93cc4</trackback:ping>
      <pingback:server>http://www.dotnetnukeblog.de/pingback.aspx</pingback:server>
      <pingback:target>http://www.dotnetnukeblog.de/PermaLink,guid,0b204ade-d19a-4d08-b422-7bdc2ce93cc4.aspx</pingback:target>
      <dc:creator>Daniel M</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">Es gibt immer wieder mal Fälle, wo man
sich gerne den von ASP.NET erzeugten Viewstate anschauen möchte, um zu sehen, welche
Kompontenten dort etwas reinschreiben, zur Optimierung, etc. 
<br /><br />
Für das Pflichttool (zumindest für Webentwickler) Fiddler gibt es genau für diese
Aufgabe eine sehr schöne Erweiterung: Den <a href="http://www.binaryfortress.com/aspnet-viewstate-helper-fiddler/">ASP.NET
ViewState Helper </a><br />
Damit kann man sich den decodierten Viewstate innerhalb vom Fiddler anschauen und
sehr schön erkennen, was dort zum Client übertragen wurde.<br /><br />
Diese Erweiterung ist kostefrei und sehr einfach zu installieren. Dafür muss man lediglich
die Software runterladen und anschließend die Datei in das Unterverzeichnis "Inspectors"
kopieren. Schon hat man nach dem nächsten Start von Fiddler einen neuen Tab-Reiter
mit dem decodierten Viewstate.<br /><p></p><img width="0" height="0" src="http://www.dotnetnukeblog.de/aggbug.ashx?id=0b204ade-d19a-4d08-b422-7bdc2ce93cc4" /></body>
      <title>asp.net viewstate analyzer</title>
      <guid isPermaLink="false">http://www.dotnetnukeblog.de/PermaLink,guid,0b204ade-d19a-4d08-b422-7bdc2ce93cc4.aspx</guid>
      <link>http://www.dotnetnukeblog.de/aspnet+Viewstate+Analyzer.aspx</link>
      <pubDate>Tue, 28 Sep 2010 12:53:12 GMT</pubDate>
      <description>Es gibt immer wieder mal Fälle, wo man sich gerne den von ASP.NET erzeugten Viewstate anschauen möchte, um zu sehen, welche Kompontenten dort etwas reinschreiben, zur Optimierung, etc. &lt;br&gt;
&lt;br&gt;
Für das Pflichttool (zumindest für Webentwickler) Fiddler gibt es genau für diese
Aufgabe eine sehr schöne Erweiterung: Den &lt;a href="http://www.binaryfortress.com/aspnet-viewstate-helper-fiddler/"&gt;ASP.NET
ViewState Helper &lt;/a&gt;
&lt;br&gt;
Damit kann man sich den decodierten Viewstate innerhalb vom Fiddler anschauen und
sehr schön erkennen, was dort zum Client übertragen wurde.&lt;br&gt;
&lt;br&gt;
Diese Erweiterung ist kostefrei und sehr einfach zu installieren. Dafür muss man lediglich
die Software runterladen und anschließend die Datei in das Unterverzeichnis "Inspectors"
kopieren. Schon hat man nach dem nächsten Start von Fiddler einen neuen Tab-Reiter
mit dem decodierten Viewstate.&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.dotnetnukeblog.de/aggbug.ashx?id=0b204ade-d19a-4d08-b422-7bdc2ce93cc4" /&gt;</description>
      <category>ASP.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.dotnetnukeblog.de/Trackback.aspx?guid=956f6cbd-5ff3-4fe4-852f-537ad2725ebd</trackback:ping>
      <pingback:server>http://www.dotnetnukeblog.de/pingback.aspx</pingback:server>
      <pingback:target>http://www.dotnetnukeblog.de/PermaLink,guid,956f6cbd-5ff3-4fe4-852f-537ad2725ebd.aspx</pingback:target>
      <dc:creator>Daniel M</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">Beim Testen eines Redesign hatte ich das
Problem das die neue Seite in allen Browsern angezeigt wurde, nur nicht im Internet-Explorer
(auf jeden Fall im IE 7 und 8). Im IE sah ich eine<b> leere Seite</b> / <b>blank page</b>.<br /><br />
Durch den Einsatz vom vom HTTP Debugging Tool Fiddler konnte ich aber sehen das der
komplette Inhalt zum Browser übertragen wurde, habe ich mir den Quellcode anzeigen
lassen, war auch alles in Ordnung. Allerdings zeigten mir die Entwicklertools - genau
wie der Browser selber - auch kein Ergebnis an.<br /><br />
Nachdem ich mir dann den Quellcode etwas näher angeschaut habe, musste ich festestellen,
dass der Code unsauber war. Im Head-Bereich habe ich das Standard-Tag <b>title </b>verwendet
aber leider sah das so aus:<br /><br />
&lt;title&gt;Meine tolle Seite&lt;title&gt;<br /><br />
Das Tag wurde leider <b>nicht geschlossen</b>. Das scheint dem IE überhaupt nicht
zu schmecken und verursacht, dass die Seite <b>komplett nicht angezeigt wird</b>.
Nachdem ich den Fehler behoben habe und das title-Tag ordnungsgemäß geschlossen hatte,
wurde auch die Seite endlich im IE angezeigt.<br /><br /><p></p><img width="0" height="0" src="http://www.dotnetnukeblog.de/aggbug.ashx?id=956f6cbd-5ff3-4fe4-852f-537ad2725ebd" /></body>
      <title>Internet Explorer zeigt eine leere Seite / IE blank page</title>
      <guid isPermaLink="false">http://www.dotnetnukeblog.de/PermaLink,guid,956f6cbd-5ff3-4fe4-852f-537ad2725ebd.aspx</guid>
      <link>http://www.dotnetnukeblog.de/Internet+Explorer+Zeigt+Eine+Leere+Seite+IE+Blank+Page.aspx</link>
      <pubDate>Thu, 23 Sep 2010 18:05:00 GMT</pubDate>
      <description>Beim Testen eines Redesign hatte ich das Problem das die neue Seite in 
allen Browsern angezeigt wurde, nur nicht im Internet-Explorer (auf 
jeden Fall im IE 7 und 8). Im IE sah ich eine&lt;b&gt; leere
Seite&lt;/b&gt; / &lt;b&gt;blank page&lt;/b&gt;.&lt;br&gt;
&lt;br&gt;
Durch den Einsatz vom vom HTTP Debugging Tool Fiddler konnte ich aber sehen das der
komplette Inhalt zum Browser übertragen wurde, habe ich mir den Quellcode anzeigen
lassen, war auch alles in Ordnung. Allerdings zeigten mir die Entwicklertools - genau
wie der Browser selber - auch kein Ergebnis an.&lt;br&gt;
&lt;br&gt;
Nachdem ich mir dann den Quellcode etwas näher angeschaut habe, musste ich festestellen,
dass der Code unsauber war. Im Head-Bereich habe ich das Standard-Tag &lt;b&gt;title &lt;/b&gt;verwendet
aber leider sah das so aus:&lt;br&gt;
&lt;br&gt;
&amp;lt;title&amp;gt;Meine tolle Seite&amp;lt;title&amp;gt;&lt;br&gt;
&lt;br&gt;
Das Tag wurde leider &lt;b&gt;nicht geschlossen&lt;/b&gt;. Das scheint dem IE überhaupt nicht
zu schmecken und verursacht, dass die Seite &lt;b&gt;komplett nicht angezeigt wird&lt;/b&gt;.
Nachdem ich den Fehler behoben habe und das title-Tag ordnungsgemäß geschlossen hatte,
wurde auch die Seite endlich im IE angezeigt.&lt;br&gt;
&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.dotnetnukeblog.de/aggbug.ashx?id=956f6cbd-5ff3-4fe4-852f-537ad2725ebd" /&gt;</description>
      <category>ASP.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.dotnetnukeblog.de/Trackback.aspx?guid=a6f7617b-747c-4ad6-a660-21410735901f</trackback:ping>
      <pingback:server>http://www.dotnetnukeblog.de/pingback.aspx</pingback:server>
      <pingback:target>http://www.dotnetnukeblog.de/PermaLink,guid,a6f7617b-747c-4ad6-a660-21410735901f.aspx</pingback:target>
      <dc:creator>Daniel M</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">Beschäftige mich aktuell intensiver mit
dem System Umbraco. Dabei versuch ich einen Datentyp für die Administration zu entwicklen,
der per AJAX Daten aus einer Datenbank lädt. Ein Datentyp in Umbraco ist z.B. ein
Textfeld, Checkbox oder ähnliches um im Adminbereich das System mit Inhalten zu befüllen.<br /><br />
Bei meiner Suche bin ich dann auf ein <b>jQuery</b>-Plugin namens <b><i>autocomplete </i></b>aufmerksam
geworden. Damit kann man eine Textbox via JavaScript mit einer autocomplete-Funktion
erweitern. Da ich die Daten aber nicht per JSON direkt mit zum Client übertragen wollte,
habe ich dafür einen asmx-Webservice geschrieben. 
<br /><br />
Die Einbindung via jQuery ist denkbar einfach und sieht in C# z.B. so aus:<br /><br /><pre><span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;"><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">private</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">void</span> _BuildAutoCompletedScript()
{ StringBuilder clientScript <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">new</span> StringBuilder();
clientScript.Append(<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"
&lt;script type='text/javascript'&gt;"</span>); clientScript.Append(<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"
$(document).ready(function() { "</span>); clientScript.AppendFormat(<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"
$(\"#{0}\").autocomplete( "</span>,<br />
                       
                   <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">this</span>.autoCompleteTextbox.ClientID);
clientScript.Append(<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"
\"/umbraco/webservices/api/mywebserive.asmx/mymethod\", "</span>); clientScript.Append(<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"
{ delay:10, minChars:2,<br /></span></span><span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;"> 
                      
              </span><span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;"><span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">matchContains:1,
cacheLength:10, autoFill:true } "</span>); clientScript.Append(<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"
); "</span>); clientScript.Append(<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"
}); "</span>); clientScript.Append(<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"
&lt;/script&gt;"</span>); <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">this</span>.Page.ClientScript.RegisterClientScriptBlock(<span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">this</span>.GetType(), <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">this</span>.ClientID <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">+</span><br />
                       
                <span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"_autocompleteData"</span>,
clientScript.ToString()); <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">this</span>.Page.ClientScript.RegisterClientScriptInclude(<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"jquery.autocomplete"</span>, <span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"><br /></span></span><span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;">  
                       
     </span><span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;"><span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"/umbraco_client/Application/JQuery/jquery.autocomplete.js"</span>);</span></pre>Auf
der Serverseite wird dann eine Web-Servicemethode definiert:<br /><br /><pre><span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;"> [WebService(Namespace <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span><span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"uri:umbraco-irgendwas"</span>)]
[WebServiceBinding(ConformsTo <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span> WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService] <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">public</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">class</span> mywebservice
: System.Web.Services.WebService { [WebMethod] <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">public</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">string</span> mymethod(<span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">string</span> q, <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">int</span> limit)
{ <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">return</span><span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"Hello
World"</span><span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">+</span> q;
} }</span></pre>Die Parameter <i>q</i> und <i>limit </i>wird vom Plugin automatisch
beim Aufruf als Parameter übergeben. Dabei ist <i>q</i> der Inhalt aus dem Textfeld
und <i>limit </i>ist die maximale Anzahl an Datensätzen, die zurück geliefert werden
sollen.<br /><br />
So weit so einfach, doch leider habe ich beim Aufruf immer einen http-Fehlercode 500
bekommen. Die Lösung habe ich noch einiger Recherche dann gefunden.<br /><br />
Die web.config muss um folgendes ergänzt werden:<br /><br /><p><font color="#0000ff"><font size="2">&lt;<font color="#a31515">webServices</font></font><font size="2"><font color="#0000ff">&gt;<br />
  &lt;</font><font color="#a31515">protocols</font></font><font size="2"><font color="#0000ff">&gt;<br />
    &lt;</font><font color="#a31515">add</font><font color="#0000ff"></font><font color="#ff0000">name</font><font color="#0000ff">=</font>"<font color="#0000ff">HttpGet</font>"</font><font size="2"><font color="#0000ff">/&gt;<br />
    &lt;</font><font color="#a31515">add</font><font color="#0000ff"></font><font color="#ff0000">name</font><font color="#0000ff">=</font>"<font color="#0000ff">HttpPost</font>"</font><font size="2"><font color="#0000ff">/&gt;<br />
    &lt;</font><font color="#a31515">add</font><font color="#0000ff"></font><font color="#ff0000">name</font><font color="#0000ff">=</font>"<font color="#0000ff">HttpSoap</font>"</font><font size="2"><font color="#0000ff">/&gt;<br />
  &lt;/</font><font color="#a31515">protocols</font></font><font size="2"><font color="#0000ff">&gt;<br />
&lt;/</font><font color="#a31515">webServices</font><font color="#0000ff">&gt;</font></font></font></p><br />
sonst kann der Web-Service nicht via GET aufgerufen werden.<br /><br /><br /><br /><br /><p></p><img width="0" height="0" src="http://www.dotnetnukeblog.de/aggbug.ashx?id=a6f7617b-747c-4ad6-a660-21410735901f" /></body>
      <title>jQuery autocomplete und aufruf eines asmx webservice per get</title>
      <guid isPermaLink="false">http://www.dotnetnukeblog.de/PermaLink,guid,a6f7617b-747c-4ad6-a660-21410735901f.aspx</guid>
      <link>http://www.dotnetnukeblog.de/jQuery+Autocomplete+Und+Aufruf+Eines+Asmx+Webservice+Per+Get.aspx</link>
      <pubDate>Wed, 22 Sep 2010 17:42:49 GMT</pubDate>
      <description>Beschäftige mich aktuell intensiver mit dem System Umbraco. Dabei versuch ich einen Datentyp für die Administration zu entwicklen, der per AJAX Daten aus einer Datenbank lädt. Ein Datentyp in Umbraco ist z.B. ein Textfeld, Checkbox oder ähnliches um im Adminbereich das System mit Inhalten zu befüllen.&lt;br&gt;
&lt;br&gt;
Bei meiner Suche bin ich dann auf ein &lt;b&gt;jQuery&lt;/b&gt;-Plugin namens &lt;b&gt;&lt;i&gt;autocomplete &lt;/i&gt;&lt;/b&gt;aufmerksam
geworden. Damit kann man eine Textbox via JavaScript mit einer autocomplete-Funktion
erweitern. Da ich die Daten aber nicht per JSON direkt mit zum Client übertragen wollte,
habe ich dafür einen asmx-Webservice geschrieben. 
&lt;br&gt;
&lt;br&gt;
Die Einbindung via jQuery ist denkbar einfach und sieht in C# z.B. so aus:&lt;br&gt;
&lt;br&gt;
&lt;pre&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;private&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;void&lt;/span&gt; _BuildAutoCompletedScript()
{ StringBuilder clientScript &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;new&lt;/span&gt; StringBuilder();
clientScript.Append(&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"
&amp;lt;script type='text/javascript'&amp;gt;"&lt;/span&gt;); clientScript.Append(&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"
$(document).ready(function() { "&lt;/span&gt;); clientScript.AppendFormat(&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"
$(\"#{0}\").autocomplete( "&lt;/span&gt;,&lt;br&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;this&lt;/span&gt;.autoCompleteTextbox.ClientID);
clientScript.Append(&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"
\"/umbraco/webservices/api/mywebserive.asmx/mymethod\", "&lt;/span&gt;); clientScript.Append(&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"
{ delay:10, minChars:2,&lt;br&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;&amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;matchContains:1,
cacheLength:10, autoFill:true } "&lt;/span&gt;); clientScript.Append(&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"
); "&lt;/span&gt;); clientScript.Append(&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"
}); "&lt;/span&gt;); clientScript.Append(&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"
&amp;lt;/script&amp;gt;"&lt;/span&gt;); &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;this&lt;/span&gt;.Page.ClientScript.RegisterClientScriptBlock(&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;this&lt;/span&gt;.GetType(), &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;this&lt;/span&gt;.ClientID &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;+&lt;/span&gt;
&lt;br&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"_autocompleteData"&lt;/span&gt;,
clientScript.ToString()); &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;this&lt;/span&gt;.Page.ClientScript.RegisterClientScriptInclude(&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"jquery.autocomplete"&lt;/span&gt;, &lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;
&lt;br&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;&amp;nbsp;&amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"/umbraco_client/Application/JQuery/jquery.autocomplete.js"&lt;/span&gt;);&lt;/span&gt;&lt;/pre&gt;Auf
der Serverseite wird dann eine Web-Servicemethode definiert:&lt;br&gt;
&lt;br&gt;
&lt;pre&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt; [WebService(Namespace &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; &lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"uri:umbraco-irgendwas"&lt;/span&gt;)]
[WebServiceBinding(ConformsTo &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService] &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;public&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;class&lt;/span&gt; mywebservice
: System.Web.Services.WebService { [WebMethod] &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;public&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;string&lt;/span&gt; mymethod(&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;string&lt;/span&gt; q, &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;int&lt;/span&gt; limit)
{ &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;return&lt;/span&gt; &lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"Hello
World"&lt;/span&gt; &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;+&lt;/span&gt; q;
} }&lt;/span&gt;&lt;/pre&gt;Die Parameter &lt;i&gt;q&lt;/i&gt; und &lt;i&gt;limit &lt;/i&gt;wird vom Plugin automatisch
beim Aufruf als Parameter übergeben. Dabei ist &lt;i&gt;q&lt;/i&gt; der Inhalt aus dem Textfeld
und &lt;i&gt;limit &lt;/i&gt;ist die maximale Anzahl an Datensätzen, die zurück geliefert werden
sollen.&lt;br&gt;
&lt;br&gt;
So weit so einfach, doch leider habe ich beim Aufruf immer einen http-Fehlercode 500
bekommen. Die Lösung habe ich noch einiger Recherche dann gefunden.&lt;br&gt;
&lt;br&gt;
Die web.config muss um folgendes ergänzt werden:&lt;br&gt;
&lt;br&gt;
&lt;p&gt;
&lt;font color="#0000ff"&gt;&lt;font size="2"&gt;&amp;lt;&lt;font color="#a31515"&gt;webServices&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;&lt;/font&gt;&lt;font color="#a31515"&gt;protocols&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/font&gt;&lt;font color="#a31515"&gt;add&lt;/font&gt;&lt;font color="#0000ff"&gt; &lt;/font&gt;&lt;font color="#ff0000"&gt;name&lt;/font&gt;&lt;font color="#0000ff"&gt;=&lt;/font&gt;"&lt;font color="#0000ff"&gt;HttpGet&lt;/font&gt;"&lt;/font&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;/&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/font&gt;&lt;font color="#a31515"&gt;add&lt;/font&gt;&lt;font color="#0000ff"&gt; &lt;/font&gt;&lt;font color="#ff0000"&gt;name&lt;/font&gt;&lt;font color="#0000ff"&gt;=&lt;/font&gt;"&lt;font color="#0000ff"&gt;HttpPost&lt;/font&gt;"&lt;/font&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;/&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/font&gt;&lt;font color="#a31515"&gt;add&lt;/font&gt;&lt;font color="#0000ff"&gt; &lt;/font&gt;&lt;font color="#ff0000"&gt;name&lt;/font&gt;&lt;font color="#0000ff"&gt;=&lt;/font&gt;"&lt;font color="#0000ff"&gt;HttpSoap&lt;/font&gt;"&lt;/font&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;/&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;/&lt;/font&gt;&lt;font color="#a31515"&gt;protocols&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;&amp;gt;&lt;br&gt;
&amp;lt;/&lt;/font&gt;&lt;font color="#a31515"&gt;webServices&lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;br&gt;
sonst kann der Web-Service nicht via GET aufgerufen werden.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.dotnetnukeblog.de/aggbug.ashx?id=a6f7617b-747c-4ad6-a660-21410735901f" /&gt;</description>
      <category>AJAX</category>
      <category>ASP.NET</category>
    </item>
  </channel>
</rss>
