locked
WCF Error "Unrecognized element" RRS feed

  • General discussion

  • I used this tutorial from Tim Heuer to create a Login Service for my Silverlight app,
    http://silverlight.net/learn/appcorner/adventureworkspt1.aspx?pt=part1

    but when I try to execute the Silverlight application this error occours:

    "Unrecognized element '' in service reference configuration. Note that only a subset of the Windows Communication Foundation configuration functionality is available in Silverlight."

    "   at System.ServiceModel.Configuration.BasicHttpSecurityElement.ReadXml(XmlReader reader)\r\n   at System.ServiceModel.Configuration.BasicHttpBindingElement.ReadXml(XmlReader reader)\r\n   at System.ServiceModel.Configuration.BasicHttpBindingCollectionElement.ReadXml(XmlReader reader)\r\n   at System.ServiceModel.Configuration.BindingsSection.ReadXml(XmlReader reader)\r\n   at System.ServiceModel.Configuration.ServiceModelSectionGroup.ReadXml(XmlReader reader)\r\n   at System.ServiceModel.Configuration.ServiceModelSectionGroup.GetSectionGroup()\r\n   at ....

    The error occours exactly in the line where I call new AuthenticationService(). If I try to go to service page directly on my browser, the service works correctly.

    I using Visual Web Developer 2008 Express Edition With SP1 and Framework 3.5 SP1.

    Can anyone give some ideias to find out whats wrong?

    My Web.Config looks like this:

    <?xml version="1.0"?>
    <configuration>
        <configSections>
            <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
                <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
                    <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
                    <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
                        <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" />
                        <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
                        <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
                        <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
                    </sectionGroup>
                </sectionGroup>
            </sectionGroup>
        </configSections>
        <appSettings />
        <connectionStrings>
            <add name="DDDBEntities" connectionString="metadata=res://*/Models.DDDBModel.csdl|res://*/Models.DDDBModel.ssdl|res://*/Models.DDDBModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\DDDB.mdf;Integrated Security=True;User Instance=True;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />
        </connectionStrings>

     

    Thursday, April 30, 2009 8:18 AM

All replies

  • It looks like you're missing the section of the web.config the error is concerned with. From the stack trace, it looks like there's an error in the BasicHttpBinding Security element: /configuration/system.serviceModel/bindings/basicHttpBinding/binding/security node. I downloaded the C# example from the site you posted and this is the section I'd look at for syntax errors:

    <bindings>
      <basicHttpBinding>
        <binding name="userHttp">
          <security mode="None"/>
        </binding>
      </basicHttpBinding>
    </bindings>
    Thursday, April 30, 2009 11:35 AM
  • Hey Michel, seens like my post has been cut off, too many chars I think. Anyway, I have this section in my Web.Confing

    Actually, it looks like this:

        <system.serviceModel>
            <behaviors>
                <serviceBehaviors>
                    <behavior name="AppServicesBehavior">
                        <serviceMetadata httpGetEnabled="true"/>
                    </behavior>
                </serviceBehaviors>
            </behaviors>
            <bindings>
                <basicHttpBinding>
                    <binding name="userHttp">
                        <!-- you would actually want to use a real security mode in a production env -->
                        <security mode="None"/>
                    </binding>
                </basicHttpBinding>
            </bindings>
            <services>
                <service name="System.Web.ApplicationServices.AuthenticationService" behaviorConfiguration="AppServicesBehavior">
                    <endpoint contract="System.Web.ApplicationServices.AuthenticationService" binding="basicHttpBinding" bindingConfiguration="userHttp" bindingNamespace="http://asp.net/ApplicationServices/v200"/>
                </service>
            </services>
            <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
        </system.serviceModel>

        <system.web.extensions>
            <scripting>
                <webServices>
                    <authenticationService enabled="true" requireSSL="false"/>
                </webServices>
            </scripting>
        </system.web.extensions>

    The full Web.Config can be found here:

    http://www.filefactory.com/file/age4ga5/n/web_config

    []'s

     

     

    Thursday, April 30, 2009 12:41 PM
  •  Ok I found the error, it wat at Client.Config and not at Web.Config, each time I add a reference to this Web.Service it add in the Client.Config the following tags:

    <security mode="None">
        <transport.....
    </security>

     That <transport> tag is not valid, why? when I remove it I can make the call to the service but another error occours this time. A not found error...

    Sunday, May 3, 2009 10:44 AM
  •  Ok I found the error, it wat at Client.Config and not at Web.Config, each time I add a reference to this Web.Service it add in the Client.Config the following tags:

    <security mode="None">
        <transport.....
    </security>

     That <transport> tag is not valid, why? when I remove it I can make the call to the service but another error occours this time. A not found error...

    Totally right! I removed it and the "unrecognized element" error disappeared. The app continued normally! What's that transport tag??!

    Monday, May 11, 2009 11:29 AM
  • Hey nosuic, dont found the answer yet, I have opened another thread to this here: http://silverlight.net/forums/p/94352/217255.aspx#217255

    If you find something please let me know.

    Monday, May 11, 2009 12:15 PM