Page 1 of 1

Error using membership in WCF

Posted: Fri 14 May 2010 08:47
by y0zh
Hello everybody. Sorry for my English.
I have a trouble using PgSqlMembershipProvider in WCF services for authentication.
My configuration section in web.config for service

Code: Select all



			
				
				
			
		
		
			
				
				
			
		
...

Code: Select all

		

    
		
			
				
					
					
          
            
          
          
				
			
		
		
			
				
          
            
          
				
			
		
		
			
        
          
            
          
        
				
				
			
		
	

When i call my method

Code: Select all

[OperationContract]
[PrincipalPermission(SecurityAction.Demand, Role = "admin")]
public string[] AdminMethod()                                      



  RefusedSet=""
  Url=""
  StackTrace:
       in System.Security.Permissions.PrincipalPermission.ThrowSecurityException()
       in System.Security.Permissions.PrincipalPermission.Demand()
       in System.Security.PermissionSet.DemandNonCAS()
       in GISService.Authenticate(String UserName, String PasswordHash) в c:\Users\User\Documents\Visual Studio 2010\Projects\MyProject\site\App_Code\MyService.cs:string 590
       in SyncInvokeAuthenticate(Object , Object[] , Object[] )
       in System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
  InnerException: 
[/quote]
  
  Why it occurs?

Posted: Thu 20 May 2010 16:18
by StanislavK
For Visual Studio 2010, the problem may be caused by the fact that the default hash algorithm was changed from SHA1 to HMACSHA256 in .NET Framework v4. We will set the hash algorithm explicitly in our code, the fix will be available in one of the nearest builds.

As a temporary workaround, please set the hash algorithm to SHA1 in ASP.NET providers of your application. For more information on this issue, please see the following topic:
http://www.devart.com/forums/viewtopic.php?t=17508

If the problem persists, please send us a small test project with which the problem can be reproduced.