p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   ASP.NET 3.5 Professionals (http://p2p.wrox.com/forumdisplay.php?f=352)
-   -   Server Error in '/' Application. (http://p2p.wrox.com/showthread.php?t=71499)

workidoo November 17th, 2008 02:58 PM

Server Error in '/' Application.
 
When I run the page loacl on my computer everything works fine. But when I upload it on a server and test it, I get error on "MyProfile.aspx" page. This is how the error message looks like:

Server Error in '/' Application.
--------------------------------------------------------------------------------

An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not 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: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

Source Error:

Line 106: End Get
Line 107: Set
Line 108: Me.SetPropertyValue("CompanyId", value)
Line 109: End Set
Line 110: End Property

Source File: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temp orary ASP.NET Files\root\02a504ec\49b021f4\App_Code.wbml5gsb.1.v b Line: 108

Stack Trace:

[SqlException (0x80131904): An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)]
   System.Data.SqlClient.SqlInternalConnection.OnErro r(SqlException exception, Boolean breakConnection) +800131
   System.Data.SqlClient.TdsParser.ThrowExceptionAndW arning(TdsParserStateObject stateObj) +186
   System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject) +737554
   System.Data.SqlClient.SqlInternalConnectionTds.Att emptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) +114
   System.Data.SqlClient.SqlInternalConnectionTds.Log inNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +421
   System.Data.SqlClient.SqlInternalConnectionTds.Ope nLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +181
   System.Data.SqlClient.SqlInternalConnectionTds..ct or(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +173
   System.Data.SqlClient.SqlConnectionFactory.CreateC onnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +133
   System.Data.ProviderBase.DbConnectionFactory.Creat ePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +30
   System.Data.ProviderBase.DbConnectionPool.CreateOb ject(DbConnection owningObject) +424
   System.Data.ProviderBase.DbConnectionPool.UserCrea teRequest(DbConnection owningObject) +66
   System.Data.ProviderBase.DbConnectionPool.GetConne ction(DbConnection owningObject) +494
   System.Data.ProviderBase.DbConnectionFactory.GetCo nnection(DbConnection owningConnection) +82
   System.Data.ProviderBase.DbConnectionClosed.OpenCo nnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105
   System.Data.SqlClient.SqlConnection.Open() +111
   System.Web.DataAccess.SqlConnectionHolder.Open(Htt pContext context, Boolean revertImpersonate) +84
   System.Web.DataAccess.SqlConnectionHelper.GetConne ction(String connectionString, Boolean revertImpersonation) +197
   System.Web.Profile.SqlProfileProvider.GetPropertyV aluesFromDatabase(String userName, SettingsPropertyValueCollection svc) +782
   System.Web.Profile.SqlProfileProvider.GetPropertyV alues(SettingsContext sc, SettingsPropertyCollection properties) +428
   System.Configuration.SettingsBase.GetPropertiesFro mProvider(SettingsProvider provider) +404
   System.Configuration.SettingsBase.SetPropertyValue ByName(String propertyName, Object propertyValue) +170
   System.Configuration.SettingsBase.set_Item(String propertyName, Object value) +89
   System.Web.Profile.ProfileBase.SetInternal(String propertyName, Object value) +139
   System.Web.Profile.ProfileBase.set_Item(String propertyName, Object value) +71
   System.Web.Profile.ProfileBase.SetPropertyValue(St ring propertyName, Object propertyValue) +8
   ProfileCommon.set_CompanyId(String Value) in C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temp orary ASP.NET Files\root\02a504ec\49b021f4\App_Code.wbml5gsb.1.v b:108
   MyProfile.btnSave_Click(Object sender, EventArgs e) in D:\hshome\workidoo\workidoo.com\MyProfile.aspx.vb: 37
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
   System.Web.UI.WebControls.Button.RaisePostBackEven t(String eventArgument) +107
   System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument) +7
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +11
   System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746



--------------------------------------------------------------------------------

Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433



I use asp.net profile propeties and believe it is somewhere in the Web.config file that I have done wrong. This is how the code behinde looks like on "MyProfile.aspx" -page:



Partial Class MyProfile
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then

txtCompanyId.Text = Profile.CompanyId

txtCompanyName.Text = Profile.CompanyName

txtImage.Text = Profile.Image

txtAdress.Text = Profile.Adress

txtPostalCode.Text = Profile.PostalCode

txtCity.Text = Profile.City

txtPhoneNumber.Text = Profile.PhoneNumber

txtFaxNumber.Text = Profile.FaxNumber

txtEmail.Text = Profile.Email

txtHomePageAdress.Text = Profile.HomePageAdress

txtAbout.Text = Profile.About

End If

Dim dtNow As Date = DateTime.Now
Using db As New workidooDataContext

Dim TotalWork = (From s In db.Works _
Select s).Count

Dim TotalWorkToday = (From s In db.Works _
Where s.Createt = Today _

Select s.Createt).Count
lblTotalWork.Text = TotalWork

lblTotalWorkToday.Text = TotalWorkToday

End Using

End Sub

Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSave.Click
If Page.IsValid Then

Profile.CompanyId = txtCompanyId.Text

Profile.CompanyName = txtCompanyName.Text

Profile.Image = txtImage.Text

Profile.Adress = txtAdress.Text

Profile.PostalCode = txtPostalCode.Text

Profile.City = txtCity.Text

Profile.PhoneNumber = txtPhoneNumber.Text

Profile.FaxNumber = txtFaxNumber.Text

Profile.Email = txtEmail.Text

Profile.HomePageAdress = txtHomePageAdress.Text

Profile.About = txtAbout.Text

End If

End Sub
End Class



If I comment the entire code inside "If End" under Page_Load Sub, the page will loaded without problems, the same thing is abolut code below Sub btnSave_Click, I get also the same error when I click the save button.

Plz Help me!


http://www.workidoo.com

dparsons November 17th, 2008 03:51 PM

There are a handful of things to check on this.

First, in SQL Server Management Studio ( I am assuming SQL2K5+ here ) right click on your database instance, select properties, then go to the connections setting found in the left pane. Make sure the 'Allow remote connections to this Server" is ticked. Go to the Security setting found directly above the Connections setting in the left pane and make sure that SQL Server and Windows Authentication Mode is ticked off under Server Authentication.

Finally, make sure that your connection string is pointed correctly and you have supplied the correct credentials.

hth.
-Doug

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========

workidoo November 18th, 2008 02:13 PM

Hi,

Thx for the answer but I can not find any of those settings that you are writing about. I connect to the database thru Microsoft SQL Server 2005 Express.

http://www.workidoo.com

Lee Dumond November 18th, 2008 03:42 PM

Go to Microsoft SQL Server 2005 > Configuration Tools > SQL Server Surface Area Configuration.

Choose "Surface Area Configuration for Services and Connections".

In the tree in the left pane, choose the database instance you want to configure (probably labeled SQLEXPRESS). Under that, expand the Database Engine node, then click on "Remote Connections".

Select the "Local and remote connections" option, with "Using TCP/IP" also selected.

Let us know how you make out.




_________________________________

Visit my blog at http://leedumond.com

workidoo November 18th, 2008 04:35 PM

 the error was that I missed <remove name="LocalSqlServer"/> in web.config


http://www.workidoo.com

NYK007 January 7th, 2009 04:28 AM

Question From NYK
 
Hi guys,

As we know that ASP.net is a very powerful language. This language is based on C# coding. But I want to know about a server error that will happen in last stage. This problem exist in '/' application.

NYK
Cash Surveys

PeterPeiGuo January 7th, 2009 04:19 PM

I would rather call ASP.Net a framework, and I certainly will not say that it is based on c#.

Quote:

Originally Posted by NYK007 (Post 232689)

As we know that ASP.net is a very powerful language. This language is based on C# coding.



All times are GMT -4. The time now is 08:17 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.