webForumDet fria alternativet

ASP:NET 2.0 Web Site Administration Tool

.NET

4 svar · 631 visningar · startad av trexter

Medlem sedan mars 20021 889 inlägg
Frågan#1

Jag körde aspnet_regsql.exe och valde att spara användarinformation för min hemsida i en databas, vid namn "VWD", som jag redan tidigare skapat och lagt till tabeller i via Visual Web Developer.

Detta fungerade väl, men då jag testar AspNetSqlProvider via "Web Site Administration Tool" händer följande:

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[SqlException (0x80131904): Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.]
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +684707
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +207
   System.Data.SqlClient.TdsParser.Connect(Boolean& useFailoverPartner, Boolean& failoverDemandDone, String host, String failoverPartner, String protocol, SqlInternalConnectionTds connHandler, Int64 timerExpire, Boolean encrypt, Boolean integratedSecurity, SqlConnection owningObject, Boolean aliasLookup) +890
   System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +601
   System.Data.SqlClient.SqlInternalConnectionTds..ctor(SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +159
   System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +108
   System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup) +27
   System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +47
   System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105
   System.Data.SqlClient.SqlConnection.Open() +111
   System.Web.Management.SqlServices.GetSqlConnection(String server, String user, String password, Boolean trusted, String connectionString) +67

[HttpException (0x80004005): Unable to connect to SQL Server database.]
   System.Web.Management.SqlServices.GetSqlConnection(String server, String user, String password, Boolean trusted, String connectionString) +123
   System.Web.Management.SqlServices.SetupApplicationServices(String server, String user, String password, Boolean trusted, String connectionString, String database, String dbFileName, SqlFeatures features, Boolean install) +90
   System.Web.DataAccess.SqlConnectionHelper.EnsureValidMdfFile(String fullFileName, String dataDir, String connectionString) +345

Web.config ser ut så här om det kan ha någon betydelse:

<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
</configuration>

Mappen "App_Data" är tom, vilket den inte ska vara, vad jag förstår.

:q

edit. Primary file path för databasen är, enligt Visual Web Developer: C:\Program\Microsoft SQL Server\MSSQL\Data\VWD.mdf. Jag antar att default är att den ska ligga i mappen "App_Data" -hur konfigurerar jag så att "den" förstår att databasen har den tidigare nämnda sökvägen i stället? :)

Medlem sedan mars 20021 889 inlägg
#2

Någon som vet hur web.config ska se ut för att ASP.NET ska förstå var databasen ligger?

Medlem sedan mars 20021 889 inlägg
#3

Hmm, har försökt att skriva web.config utifrån MS dokumentation men;

<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
  <connectionStrings>
    <add name="MyLocalSQLServer"
         connectionString="Initial Catalog=VWD;data source=localhost;Integrated Security=SSPI;" />
  </connectionStrings>

  <system.web>
    <membership defaultProvider="AspNetSqlProvider" />
  </system.web>

  [b]<authentication mode="Forms">[/b]
    <forms
           name="Spirit"
           path="/"
           requireSSL="false"
           defaultUrl="login.aspx"
           cookieless="UseCookies" />

    <authorization>
      <membership defaultProvider="MySqlMembershipProvider" >
        <providers>
          <clear/>
          <add name="MySqlMembershipProvider"
               connectionStringName="MyLocalSQLServer"
               applicationName="Spirit"
               type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
        </providers>
      </membership>      
      
      <deny users="?" />
      <allow users="*" />
    </authorization>
    
  </authentication>

</configuration>

ger felmeddelande:

 Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Unrecognized configuration section authentication.

Source Error:

Line 10:   </system.web>
Line 11: 
Line 12:   <authentication mode="Forms">
Line 13:     <forms
Line 14:            name="Spirit"

Någon? :)

Medlem sedan dec. 19996 721 inlägg
#4

authentication ska ligga inne i system.web

authorization ska ligga inne i system.web, inte i authentication

membership ska ligga inne i system.web, inte i authorization

Medlem sedan mars 20021 889 inlägg
#5

Tack emission. Har kommit lite närmare lösningen.

web.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
  <connectionStrings>
    <add name="MyLocalSQLServer"
         connectionString="Initial Catalog=VWD;data source=localhost;Integrated Security=SSPI;" />
  </connectionStrings>

  <system.web>
    <authentication mode="Forms">
      <forms
             name="Spirit"
             path="/"
             requireSSL="false"
             defaultUrl="login.aspx"
             cookieless="UseCookies" />
    </authentication>

    <authorization>
      <deny users="?" />
      <allow users="*" />
    </authorization>

    <membership defaultProvider="MySqlMembershipProvider" >
      <providers>
        <clear/>
        <add name="MySqlMembershipProvider"
             connectionStringName="MyLocalSQLServer"
             applicationName="Spirit"
             type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
      </providers>
    </membership>
  </system.web>
</configuration>

Det genereras inte längre något felmeddelande då jag kör en aspx-sida men det verkar ändå inte fungera helt.

I Web Site Administration Tool genereras felmeddelanden överallt, t ex då jag klicka på "security".

There is a problem with your selected data store. This can be caused by an invalid server name or credentials, or by insufficient permission. It can also be caused by the role manager feature not being enabled. Click the button below to be redirected to a page where you can choose a new data store.

The following message may help in diagnosing the problem: Exception has been thrown by the target of an invocation

:)

253 ms totalt · 4 externa anrop · v20260731065814-full.86ec41c2
122 ms — deklarationer (db)
0 ms — hämta statistik (cache)
128 ms — hämta tråd, inlägg och bilagor (db)
122 ms — ändringar (db)