WCF Could not load type problem

gchq

Well-known member
Joined
Dec 14, 2007
Messages
168
Programming Experience
10+
Hi there

Attempting to connect to a WCF service I am getting the following error:-

VS2010
Server 2008 R2

VB.NET:
Could not load type 'CustomValidator.CustomUserNameValidator' from assembly 'UserNameLibrary'. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.TypeLoadException: Could not load type 'CustomValidator.CustomUserNameValidator' from assembly 'UserNameLibrary'.

I added a Class Library Project to the solution and called it 'UserNameLibrary' with, so far, some very basic code:-

VB.NET:
Imports System
Imports Microsoft.VisualBasic
Imports System.Web
Imports System.IdentityModel
Imports System.IdentityModel.Selectors
Imports System.IdentityModel.Tokens
Imports System.Security.Principal
Imports System.ServiceModel

Namespace CustomValidator

    Public Class CustomUserNameValidator
        Inherits UserNamePasswordValidator

        Public Overrides Sub Validate(ByVal userName As String, ByVal password As String)
            If Nothing = userName OrElse Nothing = password Then
                Throw New ArgumentNullException()
            End If
        End Sub

    End Class
End Namespace

But getting the 'Could not load type...' error

Any ideas where to look?

Thanks
 
Turned out to be a VB naming thing - the Assembly Name and the Root Name were the same! As soon as I sorted that out it loaded without any problem... Sigh
 
Back
Top