Recently I tried to host a WCF service on IIS 6.0 with basic http binding.
I needed to authenticate users with windows security mode.
I configured the WCF binding like below in the web.config file:
<bindings>
<basicHttpBinding>
<binding name="BasicHttpWindowsBinding">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" />
</security>
</binding>
</basicHttpBinding>
</bindings>
Although I configured IIS so that anonymous authentication is not allowed and windows authentication is required, I got this error when I opened the service page with internet explorer:
System.NotSupportedException: security settings for this service require windows authentication but it is not enabled for the iis application that hosts this service
Well, it was disappointing because both service configuration and the IIS configuration was configured for windows authentication mode.
After a little struggle I found that basicHttpBinding's windows authentication is not supported by IIS 6.0.
Instead security mode of the binding should be set to Ntlm and you have to allow anonymous authentication in the IIS site settings.
Here is the complete config file:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.web>
<compilation debug="true" />
<customErrors mode="Off" />
<authentication mode="Windows">
</authentication>
<authorization>
<allow users="somedomain\someuser"/>
<deny users="*"/>
</authorization>
</system.web>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<providerOption name="CompilerVersion" value="v3.5" />
<providerOption name="WarnAsError" value="false" />
</compiler>
</compilers>
</system.codedom>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<add name="SvcFile" path="*.svc" verb="*" type="System.ServiceModel.Activation.HttpHandler" resourceType="Unspecified" preCondition="integratedMode" />
</handlers>
<directoryBrowse enabled="true" showFlags="Date, Time, Size, Extension, LongDate" />
</system.webServer>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpWindowsBinding">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Ntlm" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="SomeServiceBehavior" name="SomeAssembly.SomeService">
<endpoint binding="basicHttpBinding" bindingConfiguration="BasicHttpWindowsBinding" contract="SomeAssembly.ISomeService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="https://localhost/SomeAssembly/ISomeService.svc" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="SomeServiceBehavior">
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="True" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
Tuesday, February 9, 2010
Friday, November 6, 2009
No history entries were found for the item and version combination specified
This is a message when I tried to view the history of a folder on TFS.
I googled the message and only a few exact matches came out. First two was useless. I was terrified for an instance, but this blog entry saved me :
http://team-foundation-server.blogspot.com/2007/07/no-history-entries-were-found-for-item.html
The problem was that I had no permissions on the folder although I was an administrator. I could never remember to check the securities.
When I checked it I saw that the folder was not inheriting permissions. After inheriting permissions I could view the history of the folder.
I googled the message and only a few exact matches came out. First two was useless. I was terrified for an instance, but this blog entry saved me :
http://team-foundation-server.blogspot.com/2007/07/no-history-entries-were-found-for-item.html
The problem was that I had no permissions on the folder although I was an administrator. I could never remember to check the securities.
When I checked it I saw that the folder was not inheriting permissions. After inheriting permissions I could view the history of the folder.
Wednesday, November 4, 2009
Migrating from VSS to TFS
Beware!!! This is not a technical article about how to migrate VSS to TFS.
This is a story about my experience of migrating to TFS.
When we first met with TFS we were using Visual Source Safe 6.0.
Advisors from Microsoft came and introduced the brand new source version control system of Mirosoft, TFS. Future of the source version controls was TFS. Moreover TFS was not just another source version control system. We could even use TFS to manage projects instead of our own project management system. It also had the shelve option when you are leaving work at night. TFS brought everything we needed. They urged us to migrate to TFS because Microsoft itself was migrating to TFS. Because it was newer and better, we should quit VSS and use TFS instead.
This is a story about my experience of migrating to TFS.
When we first met with TFS we were using Visual Source Safe 6.0.
Advisors from Microsoft came and introduced the brand new source version control system of Mirosoft, TFS. Future of the source version controls was TFS. Moreover TFS was not just another source version control system. We could even use TFS to manage projects instead of our own project management system. It also had the shelve option when you are leaving work at night. TFS brought everything we needed. They urged us to migrate to TFS because Microsoft itself was migrating to TFS. Because it was newer and better, we should quit VSS and use TFS instead.
Tuesday, November 3, 2009
Get Database Schema
If you want to list the tables of a database and columns of a table you may use the "GetSchema" method of System.Data.Common.DbConnection class.
It works on both MS Sql Server 200 and 2005. I did not try on other servers.
Sample Code
DbConnection con = new OleDbConnection(connetionString);
DataTable tables =
con.GetSchema("TABLES", new string[] {null, null, null, "BASE TABLE" });
DataTable columns =
con.GetSchema("COLUMNS", new string[] {"CustomerTable", null, null });
It works on both MS Sql Server 200 and 2005. I did not try on other servers.
Sample Code
DbConnection con = new OleDbConnection(connetionString);
DataTable tables =
con.GetSchema("TABLES", new string[] {null, null, null, "BASE TABLE" });
DataTable columns =
con.GetSchema("COLUMNS", new string[] {"CustomerTable", null, null });
Saturday, January 5, 2008
Dictionary Performance
I tested performances of these classes :
A) Key-value keepers
- Dictionary
- SortedDictionary
- SortedList
B) Value keepers
- List
- HashSet
- List (Sorted and binary searched)
I inserted a number of random numbers to these classes and searched for numbers afterwards.
Below results show the average of 100 tests.
A) Key-value keepers
- Dictionary
- SortedDictionary
- SortedList
B) Value keepers
- List
- HashSet
- List (Sorted and binary searched)
I inserted a number of random numbers to these classes and searched for numbers afterwards.
Below results show the average of 100 tests.
Subscribe to:
Posts (Atom)