Don't forget to edit the web.config - adding endpoints [Resolved for DNN5+]

Oct 20, 2009 at 4:43 PM

Perhaps I missed it. Perhaps I'm just that new to WCF. 

In the tutorial for IWebCF extensions, there is no mention of modifying ~/DesktopModules/IWebCF/web.config to accommodate additional endpoints (which the example project does - IWebTabManager). 

I added a new <endpoint> to match the others under <system.serviceModel><services>:

<endpoint address="IWebTabManager" binding="ws2007HttpBinding" bindingConfiguration="ws2007HttpBinding" name="IWebTabManager" contract="DotNetNuke.Modules.IWebCF.IWebTabManager" />

I wasn't able to use (or query) the example extension (IWebTabManager) without doing this first.

Was this the intended effect? If so, it would seem like this would defeat the purpose of separating out the Contracts to ~/App_Code/IWebCF if the web.config in DesktopModules is still required to be modified. 

Or was it designed that we use the preexisting endpoints?

Thanks!

Coordinator
Oct 21, 2009 at 3:02 AM

We toiled over this exact issue for some time during the development of this module. We finally decided to use a single endpoint to expose all of the service methods. This is possible by using partial classes for example: Partial Public Class CoreService. This allows all of the service methods to be consumed without editing the web.config, something we consider to be the most complicated part of using WCF.

Technically you could do it either way. You could modify the config to expose each contract as a seperate endpoint, but this is completely optional. There are many ways this module could have been designed; however, we decided to carry forward a design from the original IWeb (asmx) module.

I do appreciate the fact that you took the time to make this post and encourage you to provide any feedback / suggestions for improved design.

Thanks!
Ian

Oct 21, 2009 at 5:14 PM
Edited Oct 21, 2009 at 5:18 PM

I am also confused by this.  I've built the IWebTabManager class and recompiled the site. I can tell that the new class took because there was a typo in the sample code that I fixed after seeing the broken compile on the site.

However, neither the sample client provided nor a perusal of the WSDL shows the IWebTabManager endpoint.

The error is:

http://localhost/dotnetnuke/DesktopModules/IWebCF/CoreService.svc/IWebTabManager' cannot be processed at the receiver, due to an AddressFilter mismatch at the EndpointDispatcher.  Check that the sender and receiver's EndpointAddresses agree.

This is DNN 5.1.x, BTW.

Oct 21, 2009 at 5:15 PM
Edited Oct 21, 2009 at 5:19 PM

<DUPLICATE POST ELIMINATED>

Oct 29, 2009 at 9:23 PM

So maybe I made a fuss about nothing. The ~/DesktopModules/IWebCF/web.config file is editable during module installation. Simply add this to the <componentssection of your DNN manifest file (.dnn):

<component type="Config">
  <config>
    <configFile>DesktopModules/IWebCF/web.config</configFile>
    <install>
      <configuration>
        <nodes>
          <node path="/configuration/system.serviceModel/services/service" action="add" key="endpoint" collision="overwrite">
            <endpoint address="IWebTabManager" binding="ws2007HttpBinding" bindingConfiguration="ws2007HttpBinding" name="IWebTabManager" contract="DotNetNuke.Modules.IWebCF.IWebTabManager" />
          </node>
        </nodes>
      </configuration>
    </install>
    <uninstall>
      <configuration>
        <nodes>
          <node path="/configuration/system.serviceModel/services/service/endpoint[@name='IWebTabManager']" action="remove" />
        </nodes>
      </configuration>
    </uninstall>
  </config>
</component>

This is working code for a different endpoint, and I only modified it to work with IWebTabManager. 

Cheers!

Coordinator
Oct 29, 2009 at 9:54 PM

Thanks Spence, that is good work! However, due to limitations with older versions of DNN this will only worker on somewhat recent editions. This was one of the main reasons we decided to go with a single endpoint that exposes all of the extension methods.

Just to be clear as to how IWebCF works as of right now. Currently IWebCF uses Partial Classes to compile all of the Extension Methods into a single class and can therefore expose all of the methods as a single endpoint. (~/DesktopModules/IWebCF/CoreService.svc/IWebTabManager)

We may look into implementing something similar to what Spence has demonstrated in future releases of IWebCF; however, I have no ETA on when a future version may be released.

Thanks!

Ian