none
mission (wcf + silverlight + basichttpbinding + transportwithmessagecredentials + asp.net sql membership provider): IMPOSSIBLE RRS feed

  • Pergunta

  • Hello everyone. I am working on a project with the following requirements:

    • Silverlight 5 at client side.
    • wcf 4.0 web service at server side.
    • username + password authentication / authorization (WITHIN SILVERLIGHT).
    • User registration (WITHIN SILVERLIGHT).

    since silverlight does not support WsHttpBinding, I decided to use BasicHttpBinding with mixed mode security: transport https certificate security for mutual authentication and message security for username + password authentication. I configured and installed a certificate at trusted people of my computer, and tested it through iis 7.5: working fine. The problem is that I just cannot get this scenario to work with asp.net authentication. I changed the server config file to and I keep getting a cross domain error. However, the clientaccesspolicy.xml file is there at the root of domain, so I think the error message is wrong.

    Some help will be much appreciated.

    <?xml version="1.0"?>
    <configuration>
      <configSections>
      </configSections>
      <!--  To collect diagnostic traces, uncomment the section below or merge with existing system.diagnostics section.
            To persist the traces to storage, update the DiagnosticsConnectionString setting with your storage credentials.
            To avoid performance degradation, remember to disable tracing on production deployments.
      <system.diagnostics>     
        <sharedListeners>
          <add name="AzureLocalStorage" type="SaveServiceGeneralServices.AzureLocalStorageTraceListener, SaveServiceGeneralServices"/>
        </sharedListeners>
        <sources>
          <source name="System.ServiceModel" switchValue="Verbose, ActivityTracing">
            <listeners>
              <add name="AzureLocalStorage"/>
            </listeners>
          </source>
          <source name="System.ServiceModel.MessageLogging" switchValue="Verbose">
            <listeners>
              <add name="AzureLocalStorage"/>
            </listeners>
          </source>
        </sources> 
       </system.diagnostics> -->
      <system.diagnostics>
        <trace>
          <listeners>
            <add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
              name="AzureDiagnostics">
              <filter type="" />
            </add>
          </listeners>
        </trace>
      </system.diagnostics>


      <system.web>
        <compilation debug="true" targetFramework="4.0" />


          <membership defaultProvider = "MySqlMembershipProvider">
            <providers>
              <add name = "MySqlMembershipProvider"
              type = "System.Web.Security.SqlMembershipProvider"
              connectionStringName = "membershipProvidersConnectionString"
              applicationName = "MyApplication"/>
            </providers>
          </membership>


        <roleManager enabled = "true" defaultProvider = "MySqlRoleManager">
          <providers>
            <add name = "MySqlRoleManager"
            type = "System.Web.Security.SqlRoleProvider"
            connectionStringName = "membershipProvidersConnectionString"
            applicationName = "MyApplication"/>
          </providers>
        </roleManager>
      </system.web>


      <system.serviceModel>


        <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
        <client />


        <behaviors>
          <serviceBehaviors>
            
            <behavior name = "Internet">


              <serviceMetadata httpsGetEnabled="true"/>
              <serviceDebug includeExceptionDetailInFaults="true" />
              <serviceAuthorization principalPermissionMode = "UseAspNetRoles" roleProviderName="MySqlRoleManager"/>
              <serviceCredentials>
                <!--<userNameAuthentication
                customUserNamePasswordValidatorType="SaveServiceGeneralServices.UserValidator, SaveServiceGeneralServices"
                userNamePasswordValidationMode="Custom"/>-->


                <userNameAuthentication userNamePasswordValidationMode = "MembershipProvider"
                                        membershipProviderName="MySqlMembershipProvider"/>
              </serviceCredentials>


            </behavior>
          </serviceBehaviors>


        </behaviors>


        <!-- define a forma segura de comunicação -->
        <bindings>
          <basicHttpBinding>
            <binding name = "silverlightBinding">
              <security mode = "TransportWithMessageCredential">
                <message clientCredentialType = "UserName"/>
                <transport clientCredentialType="None"/> 
              </security>
            </binding>
          </basicHttpBinding>
        </bindings>


        <services>
          <service name="SaveServiceGeneralServices.RegistrationService" behaviorConfiguration="Internet">
         
            <endpoint address="" binding="basicHttpBinding"
       bindingConfiguration="silverlightBinding" contract="SaveServiceGeneralServices.IRegistrationService">
            </endpoint>


          </service>
        </services>




      </system.serviceModel>


      <system.webServer>
        <modules runAllManagedModulesForAllRequests="true"/>
      </system.webServer>


      <connectionStrings>
        <add name="localConnectionString"
             providerName="System.Data.SqlClient"
             connectionString="Data Source=.\sqlexpressashade;Initial Catalog=testeSave;User Id=saveServices;Password=abkjkbl" />


        <add name="membershipProvidersConnectionString"
          providerName="System.Data.SqlClient"
          connectionString="Data Source=.\sqlexpressashade;Initial Catalog=AshadeMembership;User Id=saveServices;Password=ajbkbbkbk" />


      </connectionStrings>


     
    </configuration>

    quinta-feira, 23 de fevereiro de 2012 11:50

Todas as Respostas