More in this section

Forums / Developing with Sitefinity / Custom Widget using WCF Server Reference

Custom Widget using WCF Server Reference

2 posts, 0 answered
  1. Geoff
    Geoff avatar
    2 posts
    12 Nov 2012
    12 Nov 2012
    Link to this post
    I created a WCF Service to expose a database.  The service works fine and I was able to create a test client app that loads the server reference and calls it's functions.

    I then tried to create a Web User Control to use as a Sitefinity custom widget.  I added the Server Reference to the control and then followed the usual process of adding the widget to Sitefinity.

    When I drag the widget onto my template I get the following error:
    c:\inetpub\wwwroot\mutual\App_Data\Sitefinity\WebSiteTemplates\Mutual\WidgetTemplates\AgentFinder\AgentFinderUserControl.ascx.cs(7): error CS0234: the type or namespace 'ServiceReference1' does not exist in the namespace 'SiteFinityAgentfinder' (are you missing an assembly reference?)

    I've successfully added widgets before and my test client app is able to access the web service reference just fine. It's only when I try to do it through SiteFinity that it errors out.

     When you create a server reference it adds a binding and a client entry to the web.config. I tried putting the web.config in the widget folder but that didn't help. I also tried adding the entries to SiteFinity's web.config and that didn't work either.

  2. Geoff
    Geoff avatar
    2 posts
    12 Nov 2012
    12 Nov 2012 in reply to Geoff
    Link to this post
    Here is the source for the files.

    <?xml version="1.0"?>

      For more information on how to configure your ASP.NET application, please visit

            <compilation debug="true" targetFramework="4.0" />

                    <binding name="BasicHttpBinding_IAgencyFinderService" closeTimeout="00:01:00"
                        openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                        allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                        maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                        messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                        <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                            maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                        <security mode="None">
                            <transport clientCredentialType="None" proxyCredentialType="None"
                                realm="" />
                            <message clientCredentialType="UserName" algorithmSuite="Default" />
                <endpoint address="http://agentfinder/AgencyFinderService.svc"
                    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IAgencyFinderService"
                    contract="ServiceReference1.IAgencyFinderService" name="BasicHttpBinding_IAgencyFinderService" />

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using SiteFinityAgentFinder.ServiceReference1;

    namespace SiteFinityAgentFinder
        public partial class AgentFinderUserControl : System.Web.UI.UserControl
            protected void Page_Load(object sender, EventArgs e)
                AgencyFinderServiceClient afsc = new AgencyFinderServiceClient("BasicHttpBinding_IAgencyFinderService");
                Agency[] agencies = afsc.GetAgencyList(null);

                AgentHTMLLiteral.Text = "Agents Found: " + agencies.Count() + " Variables: " + Request.Form.Count;


    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="AgentFinderUserControl.ascx.cs" Inherits="SiteFinityAgentFinder.AgentFinderUserControl" %>

    <asp:Literal ID="AgentHTMLLiteral" runat="server" />

2 posts, 0 answered