Problems using IWebCF in a class library

May 11, 2010 at 6:55 PM

First thank you for helping me.

The "IWebCF Example App" works perfectly.  However, if I touch the code and modify it just a smidge it doesn't work anymore.  The changes I made, at least on the surface, seem innocuous enough.  All I am doing is moving the code from a "Windows Form Application" to a "Class Library" and caching some values.

I have created a separate method that in turn calls the corresponding web method.  Instead of having each method recreate the header and client, I have decided to cache their values and hold them as private member variables within the class (I assume this is an okay thing to do).  Here is a small snippet of what I am doing:

Public Class OmsWebMethodInterface

    Private moWebServiceHeader As IWebCF.IWebAuthenticationHeader
    Private moWebServiceClient As IWebCF.WebTabManagerClient

    Public Sub BuildHeaderAndClient(ByVal website As String, ByVal userName As String, _
                           ByVal password As String, ByVal passwordEncrypted As Boolean)

        moWebServiceHeader = New IWebCF.IWebAuthenticationHeader()
        With moWebServiceHeader
            .Username = userName
            .Password = password
            .Encrypted = passwordEncrypted
            .PortalID = 0
            .WebPageCall = False
        End With

        moWebServiceClient = New IWebCF.WebTabManagerClient     '<--  It bombs here with the following exception

        moWebServiceClient.Endpoint.Address = New ServiceModel.EndpointAddress _
            (String.Format("{0}/DesktopModules/IWebCF/CoreService.svc/IWebTabManager", website))
    End Sub

    Public Sub CallFoo()
    End Sub

End Class
System.InvalidOperationException was unhandled
  Message="Could not find default endpoint element that references contract 'IWebCF.IWebTabManager' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element."

So the question is two-fold.  First, why is this happening and second and most importantly, how do I put this code into a dll?  I think my question would be answered if I could see "IWebCF Example App" be converted to using a class library.  Or any other example program that calls a web method from a dll would work too. 

Again, thank you for your time,


Oct 6, 2011 at 1:27 PM
Edited Oct 6, 2011 at 1:31 PM

Looks like this project has gone completely dead since 2010.  But, I will reply as I wanted to do the same thing.  My goal was to be able to use IWebCF with my C# class library projects for DNN modules and not have to develop my WCF services as seperate files that placed in the App_Code folder.  To do this it appears you will need to change the IWebCF DNN module.  Mainly the IWEBMethods.vb in the App_Code/IWebCF/Core/BLL folder may need to be update to use reflection and process the DLL's in the bin folder rather than using the System.Web.BuildManager class to find the assemblies, interfaces, methods, etc.   Again, I just took a quick look at doing this and simply do not have the time right now to try and make it work so I will be using the documented approach.  Sorry I can't be of more help.