PDA

View Full Version : تنظیم وب کانفیگ



alvandyhamed
یک شنبه 29 دی 1392, 20:28 عصر
سلام دوستان
من زمانی که صفحه وب خودم رو از سیستمی به سیستمی دیگه جابجا میکنم بانک هاش شناخته نمیشه
برای لود شدن هم همینطور
تو وب کانفیگم آدرس بانکم به این صورت

<connectionStrings>
<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\asp netdb.mdf;User Instance=true"
providerName="System.Data.SqlClient" />
<add name="bank_fareghConnectionString" connectionString="Data Source=HF-PC\HAMED;AttachDbFilename=&quot;C:\Users\HF\Documents\V isual Studio 2010\Projects\main_faregh\main_faregh\App_Data\ban k_faregh.mdf&quot;;Integrated Security=True"
providerName="System.Data.SqlClient" />
<add name="ConnectionString" connectionString="Data Source=FIROOZEH-PC;AttachDbFilename=|DataDirectory|\bank_faregh.md f;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
حالا برای اینکه از یه سیستم به سیستم بانکم شناسایی بشه این وب کانفیگ رو باید تغییر بدم؟اگه بله چه طوری؟چی بذارم جاش؟

uthman
یک شنبه 29 دی 1392, 22:53 عصر
سلام.
بجای دیتا سورس خودت اینو بذار:
Data Source=|Data Directory|\bank_faregh.mdf

alvandyhamed
پنج شنبه 17 بهمن 1392, 21:41 عصر
حل نشد،حاجی
من بیچاره تا شنبه باید تحویل بدم گیر کردم
الان ارور زی رو واسه بانک خودم میده

Server Error in '/' Application.

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.OnErro r(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +5295167
System.Data.SqlClient.TdsParser.ThrowExceptionAndW arning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +242
System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, Boolean withFailover) +5307115
System.Data.SqlClient.SqlInternalConnectionTds.Att emptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover) +145
System.Data.SqlClient.SqlInternalConnectionTds.Log inNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout) +920
System.Data.SqlClient.SqlInternalConnectionTds.Ope nLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance) +307
System.Data.SqlClient.SqlInternalConnectionTds..ct or(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions) +434
System.Data.SqlClient.SqlConnectionFactory.CreateC onnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) +5309659
System.Data.ProviderBase.DbConnectionFactory.Creat ePooledConnection(DbConnectionPool pool, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) +37
System.Data.ProviderBase.DbConnectionPool.CreateOb ject(DbConnectionOptions userOptions) +558
System.Data.ProviderBase.DbConnectionPool.UserCrea teRequest(DbConnectionOptions userOptions) +67
System.Data.ProviderBase.DbConnectionPool.TryGetCo nnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) +1052
System.Data.ProviderBase.DbConnectionPool.TryGetCo nnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +78
System.Data.ProviderBase.DbConnectionFactory.TryGe tConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +167
System.Data.ProviderBase.DbConnectionClosed.TryOpe nConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +143
System.Data.SqlClient.SqlConnection.TryOpen(TaskCo mpletionSource`1 retry) +83
System.Data.SqlClient.SqlConnection.Open() +96
System.Web.DataAccess.SqlConnectionHolder.Open(Htt pContext context, Boolean revertImpersonate) +88
System.Web.DataAccess.SqlConnectionHelper.GetConne ction(String connectionString, Boolean revertImpersonation) +239
System.Web.Security.SqlMembershipProvider.GetPassw ordWithFormat(String username, Boolean updateLastLoginActivityDate, Int32& status, String& password, Int32& passwordFormat, String& passwordSalt, Int32& failedPasswordAttemptCount, Int32& failedPasswordAnswerAttemptCount, Boolean& isApproved, DateTime& lastLoginDate, DateTime& lastActivityDate) +821
System.Web.Security.SqlMembershipProvider.CheckPas sword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved, String& salt, Int32& passwordFormat) +88
System.Web.Security.SqlMembershipProvider.Validate User(String username, String password) +106
System.Web.UI.WebControls.Login.AuthenticateUsingM embershipProvider(AuthenticateEventArgs e) +59
System.Web.UI.WebControls.Login.OnAuthenticate(Aut henticateEventArgs e) +113
System.Web.UI.WebControls.Login.AttemptLogin() +119
System.Web.UI.WebControls.Login.OnBubbleEvent(Obje ct source, EventArgs e) +75
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
System.Web.UI.WebControls.Button.OnCommand(Command EventArgs e) +114
System.Web.UI.WebControls.Button.RaisePostBackEven t(String eventArgument) +159
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +35
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1724
حالا این یه مشکل ،مشکل دوم این که بانک خود Web Site Administration Tool هم مشکل داره بانکش رو نمیشناسه و زمانی که وارد قسمت مدیریت میشم خطای زیر رو میده

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: 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)

تو رو خدا به دادم برسید ،یه بار نشد ما یه نتیجه بگیریم از این تاپیک ها:گریه::گریه::گریه::گریه::گر ه:

Mohammad_dn
پنج شنبه 17 بهمن 1392, 21:48 عصر
شما تمام مشکلت اینجاس
C:\Users\HF\Documents\Visual Studio 2010\Projects\main_faregh\main_faregh\App_Data\ban k_faregh.mdf

اینجوری که آدرس نمیدن....شما برو SQLServerExpress رو دان کن نصب کن.....اینجوری خیلی بهتره..بعد هرجا خواستی SQLServerExpress رو نصب کن(نصبش چند
دقیقه ایه)
ایجاد بانک و بعد هم کانکشن استرینگ

من همیشه همینکارو میکنم و مشکلی هم ندارم

alvandyhamed
جمعه 18 بهمن 1392, 10:11 صبح
شما تمام مشکلت اینجاس
C:\Users\HF\Documents\Visual Studio 2010\Projects\main_faregh\main_faregh\App_Data\ban k_faregh.mdf

اینجوری که آدرس نمیدن....شما برو SQLServerExpress رو دان کن نصب کن.....اینجوری خیلی بهتره..بعد هرجا خواستی SQLServerExpress رو نصب کن(نصبش چند
دقیقه ایه)
ایجاد بانک و بعد هم کانکشن استرینگ

من همیشه همینکارو میکنم و مشکلی هم ندارم

نمیشه برادر من ،آقا من مشکل دارم تو رو خدا یکی به داد من برسه شنبه تحویل پروژه دارم ،یه مسلمونی کمک کنه
نه بانک خودم نه بانک مدیریت کاربرانم شناخته نمیشه ،یه مسلمونی به داد برسه

Sharar3D
جمعه 18 بهمن 1392, 13:50 عصر
برای استفاده از بانک اطلاعات SQL باید حتما سرور SQL رو هم نصب داشته باشی
حالا یا نسخه SQLServerExpress یا نسخه کاملش، یکی رو باید نصب داشته باشی، بعد اون بانک مورد نظرت رو باید attach کنی تا توی پایگاه داده نمایش دده بشه.
در آخر برنامت میتونه با آدرس درست به اون بانک دسترسی داشته باشه.
اگر خیلی اینا دردسر داره واست، از بانک Access استفاده کن که همراه آفیس نصب میشه، خوبیش اینه که نیازی به نصب هیچ گونه پایگاه داده ای نداری تا بتونی ازش استفاده کنی، اما خوب از لحاظ کارایی خیلی مذخرفه ..
یه توضیح هم در مورد کانکشن استرینگ :
Data Source=FIROOZEH-PC;AttachDbFilename=|DataDirectory|\bank_faregh.md f;Integrated Security=True
Data Source= اینجا باید اسم سروری که پایگاه داده روش نصبه نوشته بشه. به صورت پیش فرض میشه اسم خود سیستم. مثل همینی که بالا نوشته شده.
AttachDbFilename= اسم بانک داده هات به همراه مسیرش. مسیر فیزیکی رو زمانی وارد می کنن که میخوان مستقیم به یک دیتابیس وصل بشن ( که به نظر من اشتباس ). ترجیحا باید با برنامه MSSQL Server Management Studio به پایگاه دادت وصل بشی و از اونجا دیتابیس رو بهش متصل ( Attach ) کنی و بعد کانکشن بانک رو جوری بنویسی که به سرور وصل بشه و از اونجا به بانک دسترسی پیدا کنه.
این کانکشینی هست که من توی اخرین برنامم استفاده کردم :
<add name="MainDb" connectionString="Data Source=HOME-PC;Initial Catalog=DatabseNameGoesHere;Persist Security Info=True;User ID=UserNameGoesHere;Password=PasswordGoesHere"/>


البته با مال شما تفاوتی داره و اونم اینه که من پایگاه دادم رو تنظیم کردم که با نام کاربری و کلمه عبور بش وصل بشم.
شما فقط کاری که باید انجام بدید اینه که به جای اینکه خودتون مستقیم به بانکتون وصل بشید، بانکتون رو با برنامه MSSQL Server Management Studio به سرور پایگاه دادتون وصل کنید( Attach ) بعد با خود برنامه Visual Studio از بانکتون استفاده کنید.