2012-04-15 29 views
0

Ich arbeite an einer Web-Anwendung, in der ich einige Berechtigungen hinzufügen muss und so habe ich eine Datenbank ASPNETDB.MDF und ich möchte meine Anwendung WATERINFO.MDF von SQL Server verwenden.Aktualisierung von web.config, um aspnetdb in eine eigene Datenbank zu ändern?

Ich habe upadted WATERINFO.MDF mit all Schema und unter Verwendung von Daten aspnet_regsql.exe

Derzeit meine web.config-Datei von Silverlight-Anwendung ist

<?xml version="1.0"?> 
<configuration> 
    <configSections> 
    <sectionGroup name="system.serviceModel"> 
     <section name="domainServices" type="System.ServiceModel.DomainServices.Hosting.DomainServicesSection, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" allowDefinition="MachineToApplication" requirePermission="false" /> 
    </sectionGroup> 
    </configSections> 

    <system.web> 
    <httpModules> 
     <add name="DomainServiceModule" type="System.ServiceModel.DomainServices.Hosting.DomainServiceHttpModule, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
    </httpModules> 
    <compilation debug="true" targetFramework="4.0" /> 

    <roleManager enabled="true"/> 

    <authentication mode="Forms"> 
     <forms name=".AuthorizationSample_ASPXAUTH" /> 
    </authentication> 

    <profile> 
     <properties> 
     <add name="FriendlyName"/> 
     </properties> 
    </profile> 

    </system.web> 

    <system.webServer> 
    <validation validateIntegratedModeConfiguration="false"/> 
    <modules runAllManagedModulesForAllRequests="true"> 
     <add name="DomainServiceModule" preCondition="managedHandler" 
      type="System.ServiceModel.DomainServices.Hosting.DomainServiceHttpModule, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
    </modules> 
    </system.webServer> 

    <system.serviceModel> 
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /> 
    </system.serviceModel> 
</configuration> 

Nun, es zu ändern i WATERINFO.MDF muß Konfigurationsdatei aktualisieren

 <?xml version="1.0"?> 
    <configuration> 
<connectionStrings> 
     <add name="DefaultConnectionString" connectionString="Data Source=COMPLEX\SQLEXPRESS;Initial Catalog=waterinfo;Integrated Security=True" 
    providerName="System.Data.SqlClient" /> 

     </connectionStrings> 
     <configSections> 
     <sectionGroup name="system.serviceModel"> 
      <section name="domainServices" type="System.ServiceModel.DomainServices.Hosting.DomainServicesSection, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" allowDefinition="MachineToApplication" requirePermission="false" /> 
     </sectionGroup> 
     </configSections> 



     <system.web> 

     <roleManager enabled="true" defaultProvider="DPISqlRoleProvider"> 
      <providers> 
      <add connectionStringName="DefaultConnectionString" applicationName="DPI" name="DPISqlRoleProvider" 
    type="System.Web.Security.SqlRoleProvider"/> 

      </providers> 
     </roleManager> 
     <httpModules> 
      <add name="DomainServiceModule" type="System.ServiceModel.DomainServices.Hosting.DomainServiceHttpModule, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
     </httpModules> 
     <compilation debug="true" targetFramework="4.0" /> 



     <authentication mode="Forms"> 

     </authentication> 


     <membership defaultProvider="DPISqlMembershipProvider"> 

      <providers> 
      <add connectionStringName="DefaultConnectionString" enablePasswordRetrieval="false" enablePasswordReset="true" 
    requiresQuestionAndAnswer="true" applicationName="DPI" requiresUniqueEmail="true" passwordFormat="Hashed" 
    maxInvalidPasswordAttempts="5" minRequiredPasswordLength="4" minRequiredNonalphanumericCharacters="0" 
    passwordAttemptWindow="10" passwordStrengthRegularExpression="" name="DPISqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider"/> 

      </providers> 
     </membership> 
     <profile> 
      <properties> 
      <add name="FriendlyName"/> 
      </properties> 
     </profile> 

     </system.web> 

     <system.webServer> 
     <validation validateIntegratedModeConfiguration="false"/> 
     <modules runAllManagedModulesForAllRequests="true"> 
      <add name="DomainServiceModule" preCondition="managedHandler" 
       type="System.ServiceModel.DomainServices.Hosting.DomainServiceHttpModule, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
     </modules> 
     </system.webServer> 

     <system.serviceModel> 
     <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /> 
     </system.serviceModel> 
    </configuration> 

ich diese Änderungen in meiner web.config-Datei aktualisiert, aber war nicht in der Lage, die Datenbank neu zu ändern.

Auch ich weiß, ich <remove "LocalSqlServer"> verwenden können, aber das ist jetzt gut für die Produktion Zweck

Bitte legen nahe, welche Änderung sollte ich in meiner Datei web.config machen.

Dank

Antworten

+0

Changed Titel und Inhalt zu aktualisieren, da Sie zu ändern versuchen, die Einstellungen für diese Website, die das Silverlight-Paket hostet. Es ist immer noch eine Website und das Ändern der Einstellungen hat nichts mit Silverlight zu tun. –

Antwort

0

ich das Problem gelöst, gab es einige Verbindungszeichenfolge Fehler und einige andere Minuten verändert ... Ich brauche Web.Config-Datei als solche

<?xml version="1.0"?> 
<configuration> 
    <configSections> 
    <sectionGroup name="system.serviceModel"> 
     <section name="domainServices" type="System.ServiceModel.DomainServices.Hosting.DomainServicesSection, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" allowDefinition="MachineToApplication" requirePermission="false" /> 
    </sectionGroup> 
    </configSections> 
    <connectionStrings> 
    <add name="DefaultConnectionString" connectionString="My Connection Details" 
providerName="System.Data.SqlClient" /> 

    </connectionStrings> 


    <system.web> 

    <roleManager enabled="true" defaultProvider="DPISqlRoleProvider"> 
     <providers> 
     <add connectionStringName="DefaultConnectionString" applicationName="DPI" name="DPISqlRoleProvider" 
type="System.Web.Security.SqlRoleProvider"/> 

     </providers> 
    </roleManager> 
    <httpModules> 
     <add name="DomainServiceModule" type="System.ServiceModel.DomainServices.Hosting.DomainServiceHttpModule, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
    </httpModules> 
    <compilation debug="true" targetFramework="4.0" /> 



    <authentication mode="Forms"> 

    </authentication> 


    <membership defaultProvider="DPISqlMembershipProvider"> 

     <providers> 
     <add connectionStringName="DefaultConnectionString" enablePasswordRetrieval="false" enablePasswordReset="true" 
requiresQuestionAndAnswer="true" applicationName="DPI" requiresUniqueEmail="true" passwordFormat="Hashed" 
maxInvalidPasswordAttempts="5" minRequiredPasswordLength="4" minRequiredNonalphanumericCharacters="0" 
passwordAttemptWindow="10" passwordStrengthRegularExpression="" name="DPISqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider"/> 

     </providers> 
    </membership> 
    <profile> 
     <properties> 
     <add name="FriendlyName"/> 
     </properties> 
    </profile> 

    </system.web> 

    <system.webServer> 
    <validation validateIntegratedModeConfiguration="false"/> 
    <modules runAllManagedModulesForAllRequests="true"> 
     <add name="DomainServiceModule" preCondition="managedHandler" 
      type="System.ServiceModel.DomainServices.Hosting.DomainServiceHttpModule, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
    </modules> 
    </system.webServer> 

    <system.serviceModel> 
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /> 
    </system.serviceModel> 
</configuration> 
0

Sie müssen den Tag unter connection configSections setzen. configSections muss der erste sein, wie in der msdn angegeben.

+0

Hallo habe ich geändert und die Frage aktualisiert. Aber es wird nicht verbunden – TheBond