czwartek, 11 czerwiec 2009

Create and Install Temporary Certificates in WCF

You can find full article here

Most important parts:
1) Create a Certificate to Act as Your Root Certificate Authority

makecert -n "CN=RootCATest" -r -sv RootCATest.pvk RootCATest.cer

2) Create and Install Your Temporary Service Certificate

makecert -sk MyKeyName -iv RootCATest.pvk -n "CN=tempCert" -ic RootCATest.cer -sr localmachine -ss my -sky exchange -pe tempCert.cer

3) In Client config set RevocationMode to "NoCheck"

<behaviors>
<endpointBehaviors>
<behavior name="NewBehavior">
<clientCredentials>
<serviceCertificate>
<authentication *revocationMode="NoCheck" />
</serviceCertificate>
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
<client>
<endpoint behaviorConfiguration="NewBehavior" ….>
</endpoint>
</client>

wtorek, 9 czerwiec 2009

"Add Service Reference" 16384 quota

If you got a problem with adding large WCF service into your Visual Studio sollution via "Add Service Reference" you can use following sollution.

You need to edit devenv.exe.config (default located in c:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\) and add larger quota info to IMetadataExchange binding. This configuration will be used by VS and it is used for netTcpBinding.

<configuration>
.
.
.
<system.serviceModel>
<client>
<endpoint name="net.tcp" binding="netTcpBinding" bindingConfiguration="bc" contract="IMetadataExchange" />
</client>
<bindings>
<netTcpBinding>
<binding name="bc" maxReceivedMessageSize="512000">
<readerQuotas maxNameTableCharCount="163840" />
<security mode="None"/>
</binding>
</netTcpBinding>
</bindings>
</system.serviceModel>
.
.
.
</configuration>

poniedziałek, 4 maj 2009

Finding objects in Generics with List.Find()

Simple class:

public class Person
{
   public int ID { get; set; }
   public int Name { get; set; }

   public Person(int id, string name)
   {
      ID = id;
      Name = name;
   }
}

Usage code:

//Add some objects
List myList = new List();
myList.Add(new Person(1, "Person 1"));
myList.Add(new Person(2, "Person 2"));
myList.Add(new Person(3, "Person 3"));

//Find a specific object
Person myLocatedObject = myList.Find(delegate(Person p) {return p.ID == 1; });


Thanks Andrey for good example (original article)

czwartek, 29 maj 2008

Fixing Firefox Slowness with local developement server on Vista

It's really an anoying problem. Firefox runs like a turtle on local developement server on Vista:( But there is a nice sollution for this one:
In Firefox, goto about:config, filter by "network.dns.disableIPv6" and double-click to set to true.

Here you go :)

32 bit ODBC Datasources on 64 bit Vista

Having problem with the 64 bit ODBC Datasources manager on Vista ?
The launcher for 32 bit version is located under:
C:\Windows\SysWOW64\odbcad32.exe

poniedziałek, 11 luty 2008

How to reset identity seed in Sql Server

Sometimes you need to reset indentity seed in your database table. There is a nice way to achive that (sql command):

DBCC CHECKIDENT('table_name', RESEED, 0)

wtorek, 22 styczeń 2008

How to remove primary key column in DataTable

Sometimes you need to drop column from DataTable which is marked as PrimaryKey (else you will get an exception). There's a nice way to accomplish that.

DataTable.PrimaryKey = null;

So simple, so nice :)