povezivanje sa bazom na serveru,problem

povezivanje sa bazom na serveru,problem

offline
  • Software developer
  • Pridružio: 06 Sep 2005
  • Poruke: 3800
  • Gde živiš: Beograd

Pozdrav

Poceo sam nesto da cackam oko asp.net , nisam ranije radio i , u lokalu mi sve radi super, ali kad prebacim na server(naravno, win hosting) ne moze da mi se poveze sa bazom.

Koji je postupak prebacivanja? Prebacio sam ceo folder znaci i ono sto ima u App_data i ono sto je u folderu iznad tog.

Connection string mi izgleda ovako:
<add name="test" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\test.mdf;Database=test;Trusted_Connection=Yes;" />
To bi trebalo da radi , zar ne? Postoji test.mdf u app_data folderu...
Da li treba jos negde nesto da podesim?
Upitanju je jednostavna test tabea sa 3 imena u sebi koja treba da se ispisu u padajuci meni.
dakle imam ovo na stranici[izmedju ostalog]
<asp:SqlDataSource ID="SqlDataSource1" runat="server"         ConnectionString="<%$ ConnectionStrings:test %>"         SelectCommand="SELECT * FROM [imena]"></asp:SqlDataSource>     <br />     <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"         DataSourceID="SqlDataSource1" DataTextField="ime" DataValueField="ime">     </asp:DropDownList>
a kao gresku mi stalno prijavljuje :
Citat:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

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): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +5009598
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() +234
System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity) +341
System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, SqlConnection owningObject) +129
System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, TimeoutTimer timeout) +270
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, TimeoutTimer timeout, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +195
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +232
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +185
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +33
System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +524
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66
System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +479
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +108
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +126
System.Data.SqlClient.SqlConnection.Open() +125
System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +123
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +319
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +92
System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1618
System.Web.UI.WebControls.ListControl.OnDataBinding(EventArgs e) +97
System.Web.UI.WebControls.ListControl.PerformSelect() +34
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +74
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +66
System.Web.UI.WebControls.ListControl.OnPreRender(EventArgs e) +29
System.Web.UI.Control.PreRenderRecursiveInternal() +103
System.Web.UI.Control.PreRenderRecursiveInternal() +175
System.Web.UI.Control.PreRenderRecursiveInternal() +175
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2496



Da li neko zna kako da sredim ovo i u cemu je problem?



Registruj se da bi učestvovao u diskusiji. Registrovanim korisnicima se NE prikazuju reklame unutar poruka.
offline
  • Pridružio: 18 Apr 2003
  • Poruke: 5001
  • Gde živiš: Beograd

Jel nemas negde u hosting kontrol panelu da pravis bazu? Obicno se za baze koristi razlicit server, mislim da ne mozes tek tako bazu da uploadujes kao fajl, tako bi mogao neogranicen broj baza da koristis sto obicno nije slucaj.



offline
  • Software developer
  • Pridružio: 06 Sep 2005
  • Poruke: 3800
  • Gde živiš: Beograd

To je i mene bunilo, imam za pravljenje baze i dozvoljneno je jedna baza da se ubaci.

Malo se teze snalazim u ovom okruzenju i cpanelu jer nisam ranije radio , al evo, recimo napravio sam novu bazu , pojavila se, i recimo da je sad napunim i sve, i uspem da se povezem na nju i da mi izlista. Znaci, preko toga sada radi, promenio sam connection string, koristio sam ovaj tip:
Server=myServerAddress;Database=myDataBase;User ID=myUsername;Password=myPassword;Trusted_Connection=False;

Pretpostavljam da bih njih trebao da pitam da li postoji mogucnost koriscenja .mdf kao baze?

Jer ovako mi je neprakticno da radim, prvo skroz je cudan admin panel, a drugo malo je nezgodno kad radim testiranje u lokalu i posle se prebacim na server, ne vidim nigde upload baze cele sa podacima, nesto kao import/export...

offline
  • Pridružio: 18 Apr 2003
  • Poruke: 5001
  • Gde živiš: Beograd

Ja predpostavljam da mozes da dogovoris sa tehnickom podrskom da im posaljes fajl na mail i da oni ubace, ali to bas nije prakticno ako ti treba cesce da postavis novi mdf fajl. Najbolje da ih pitas da li ima laksi nacin, nista te ne kosta.

Eventualno da probas sa SQL Managerom da se povezes na njihov server i iz managera uploadujes novu bazu, ali ne mogu da se setim sada kako se zove ta opcija (valjda Restore database).

offline
  • Software developer
  • Pridružio: 06 Sep 2005
  • Poruke: 3800
  • Gde živiš: Beograd

Napisano: 06 Feb 2011 20:47

Ok, hvala na informacijama, pitacu ih.

Kad bih znao da to uopste neki web host podrzava ne bi bio problem, presao bih tamo, ali ne znam ni dal ima to negde u napomeni, nisam vidjao

Hvala jos jednom

Dopuna: 06 Feb 2011 23:26

Dobio sam odgovor:

Dear Nikola,
You can use .mdf file for database.

:S

Znaci da nesto drugo pravi problem...
dal nije moj connection string?
<add name="test" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\test.mdf;Database=test;Trusted_Connection=Yes;" />
Al mislim da je u redu....
uzeo sam ga odavde: http://www.connectionstrings.com/sql-server-2008

offline
  • Pridružio: 05 Maj 2010
  • Poruke: 112

Pa promeni datadirectory deo u putanju na kojoj ti je baza...

Ko je trenutno na forumu
 

Ukupno su 761 korisnika na forumu :: 32 registrovanih, 5 sakrivenih i 724 gosta   ::   [ Administrator ] [ Supermoderator ] [ Moderator ] :: Detaljnije

Najviše korisnika na forumu ikad bilo je 3466 - dana 01 Jun 2021 17:07

Korisnici koji su trenutno na forumu:
Korisnici trenutno na forumu: _Petar, A.R.Chafee.Jr., AC-DC, Apotekar, awathorn, Belac91, bojank, CrazyDiablo, dankisha, dejina811, Deneb, djordje92sm, Duh sa sekirom, HrcAk47, ivica976, Japidson, Joja, Majstorr, Marko Marković, mačković, Milan A. Nikolic, moonshine, MrNo, mushroom, Pakito93, sizif, Smiljke, Snorks, vlad the impaler, voja64, vukovi, wolf431