Showing posts with label WCF. Show all posts
Showing posts with label WCF. Show all posts

Wednesday, February 10, 2010

WCF and Performance Counters

To enable counters for WCF services add following line


<diagnostics performanceCounters="All" />


at the xml element


<system.serviceModel>


in web.config file or in machine config file (for all services on your machine).

To see counters data start from command line:

perfmon.exe


Open performance monitor and add counter from: ServiceModelService

Friday, August 07, 2009

Geneva framework and WCF service to WCF service identity delegation

In order to use credentials from WCF service to call method on other WCF service that also use authentication from Geneva Framework STS you can use code like following:

var principal = Thread.CurrentPrincipal as IClaimsPrincipal;
var callerTokens = principal.GetBootstrapTokens();

using (var serviceFactory = new ChannelFactory("WSFederationHttpBinding_IMyApi"))
{
serviceFactory.ConfigureChannelFactory();

if (callerTokens.Count > 0)
{
var service = serviceFactory.CreateChannelActingAs(callerTokens[0]);
service.SomeMethod();
}
}

Tuesday, July 14, 2009

Custom user for application pool

When I change default application pool for my WCF application and I set non admin credential I start to getting following error:

"secure channel cannot be opened because security negotiation with the remote endpoint has failed"

The thing was to set "Load User Profile" in settings for application pool to true

Friday, February 20, 2009

Missing svc handler

Windows 2008 comes with installed .NET framework 3.5 but without installed IIS. When you install IIS you don't have support for WCF (there is no handler for svc). To install support for svc open command prompt and go to .net framework 3.0 location (:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation\) and run:

servicemodelreg -i

Wednesday, February 04, 2009

An error occurred when verifying security for the message

One of the possible reasons:

- Check if the time on the server and the time on the client does not match.

Tuesday, October 14, 2008

WCF, IIS, Keyset does not exist

- Error: Keyset does not exist error when I try to test WCF project with X509 security.

Solution:
  1. Check if WCF support is installed for IIS:
  2. If you are using certificate, check if application pool have access permissions for private key. To provide access permissions do:
    1. Find IIS application pool identity
    2. Find private key file name for certificate (FindPrivateKey.exe):
    3. Add read permissions for IIS application pool identity (cacls.exe) or just open windows explorer and set permissions




Friday, October 10, 2008

Create certificate

To create certificate for use in WCF for example you can use Visual Studio command line tool makecert and pvk2pfx

For more information look here

Thursday, October 09, 2008

SqlRoleProvider - change password length

To change required password length add this section in config file:



<system.web>


<roleManager enabled="true" > </roleManager>


<membership>


<providers>


<clear/>


<add name="AspNetSqlMembershipProvider"


connectionStringName="LocalSqlServer"


enablePasswordRetrieval="false"


enablePasswordReset="true"


requiresQuestionAndAnswer="false"


applicationName="/"


requiresUniqueEmail="true"


passwordFormat="Hashed"


maxInvalidPasswordAttempts="10"


minRequiredPasswordLength="3"


minRequiredNonalphanumericCharacters="0"


passwordAttemptWindow="10"


passwordStrengthRegularExpression=""


type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>


</providers>


</membership>


Wednesday, October 08, 2008

Remove http://tempuri.org/ from wcf service

To remove tempuri.org you should define your own namespace in service contract atribute



    [ServiceContract(Namespace="http://myuri.com/")] 


Tuesday, October 07, 2008

The Address property on ChannelFactory.Endpoint was null

You created web service client, set up config file using Service Configuration Editor and you get

The Address property on ChannelFactory.Endpoint was null

message

You probably forgot to add configuration name in

new ChannelFactory();

method