2012-04-15 1 views
0

私はいくつかの権限を追加する必要があるWebアプリケーションで作業しているので、データベースASPNETDB.MDFを持っていて、SQLサーバからWATERINFO.MDFを使用するようにアプリケーションを設定します。aspnetdbを自分のデータベースに変更するためにweb.configを更新しますか?

私はSilverlightのアプリの私のweb.configファイルがWATERINFO.MDF私にそれを変更する

<?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> 

ある現状では

aspnet_regsql.exe使用して、すべてのスキーマとデータをWATERINFO.MDFをupadtedています設定ファイル

 <?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> 

を更新する必要があり、私は私のweb.configファイルでこれらの変更を更新しましたが、新しいものにデータベースを変更することができませんでした。

私は私のweb.configファイルで作成すべきかの変更を提案してください。また、私は<remove "LocalSqlServer">を使用することができます知っているが、それは今、生産目的

のために良いことです。

おかげ

返信

+0

としてweb.configファイルを更新する必要があります...変更SilverlightパッケージをホストするこのWebサイトの設定。まだWebサイトであり、その設定を変更することはSilverlightとは関係ありません。 –

答えて

0

、いくつかの接続文字列のエラーや他のいくつかの分があった私は、そのような

あなたが変更しようとしているとして、タイトルと内容を変更
<?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

あなたはconfigSections以下のconnectionStringsタグを配置する必要があります。 msdnに記載されているように、configSectionsが最初のものでなければなりません。私は問題を解決し

+0

こんにちは、それを変更し、質問を更新しました。しかし、接続されていない – TheBond

関連する問題