PDA

Bekijk Volledige Versie : Hulp: ASP.net ,MS SQL en Microsoft Visual Studio 2005



gandert
19/03/07, 01:02
Hallo,
Ik heb al enkele malen mijn probleem voorgelecht in forum's maar tot nu toe geen

deftige informatie gekregen.

Wat ik wil is een asp.net pagina maken waaraan ik een Microsoft SQL database koppel

(redelijk gewoon dacht ik) en ik zou willen Microsoft Visual studio pro 2005 blijven

gebruiken.

Mijn problemen:

1.

- Ik kan geen foutmeldingen online zien.

IE zegt steeds dat ik de web.config moet aanpassen zodanig dat bezoekers ook de

foutmelding kunnen zien. Dit heb ik dan gedaan en nog steeds is de foutmelding niet

zichtbaar.

Hironder de code die IE toont:



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

Runtime Error
Description: An application error occurred on the server. The current custom error

settings for this application prevent the details of the application error from being

viewed remotely (for security reasons). It could, however, be viewed by browsers

running on the local server machine.

Details: To enable the details of this specific error message to be viewable on remote

machines, please create a <customErrors> tag within a "web.config" configuration file

located in the root directory of the current web application. This <customErrors> tag

should then have its "mode" attribute set to "Off".


<!-- Web.Config Configuration File -->

<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>


Notes: The current error page you are seeing can be replaced by a custom error page by

modifying the "defaultRedirect" attribute of the application's <customErrors>

configuration tag to point to a custom error page URL.


<!-- Web.Config Configuration File -->

<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>



2.
Dan had ik het gevraagd aan mijn hosting beheerder om dit te checken en zij konden de

code zien via de server en hebben deze mij bezorgt.

correcte foutmelding:



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

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 'connectionStrings'

Source Error:


Line 10: <configuration>
Line 11: <appSettings/>
Line 12: <connectionStrings>
Line 13: <add name="SpionshopConnectionString" connectionString="Data

Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\Gand ert\Desktop\we\Spionshop.mdf;Integra

ted Security=True;Connect Timeout=30;User Instance=True"

providerName="System.Data.SqlClient"/>
Line 14: </connectionStrings>


Source File: d:\accounts\l\o\londen5714\WWW\test\web.config Line: 12


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.2300; ASP.NET

Version:1.1.4322.2300




Dit is een normale foutcode. maar ik niet wat er verkeerd mee is (volgens mij niets).

Normaal gezien zou er geen fout mogen instaan want ik heb de code niet handmatig

geschreven.
Ik heb Visual studio pro 2005 van microsoft gebruikt om deze pagina te maken en heb

zelf niet van code's ingevoerd (met visual studio kan je de database min of meer

slepen naar de pagina en visual doet dan de rest).

Hoe komt het dat er dan een fout op staat is mijn vraag?

En hoe kan ik dit oplossen?



Ik wil dus dat ik foutmeldingen kan zien via internet (zodinag dat ik ze kan oplossen)

en dat mijn database werkt.

Hier heb ik al mijn bestanden in een zip file geplaatst:

worldcitytrips.com/test/web.zip

info bij zip: de zip bestanden die in de zip zitten moeten een map worden (met de naam

die de zips hebben) met de bestanden erin.
Alle bestanden en 2 mappen plaats ik dan gewoon (gewoon zoals ik alles oplaad) op mijn

server.


Test gelieve zelf even.


Ik hoop dat ik Visual studio kan blijven gebruiken want dit is wel een zeer eenvoudig

programma.


Als iemand hier een oplossing heeft kan hij mij gerust contacteren op mijn mail of msn

lamsgandert@hotmail.com


Mvg
Gandert

gjtje
19/03/07, 01:24
De applicatie draait onder asp.net 1.1 i.p.v 2.0. De host kan dit voor je aanpassen, het kan soms ook via het control panel.

De sectie connectionStrings is nieuw in ASP.Net 2.0.

gandert
19/03/07, 09:55
Dus het licht aan de instellingen van mijn host beheerder?

Mijn bestanden zijn dus heelemaal correct of niet?

Hoe komt het dan dat ik mijn foutmeldingen niet kan zien?


Alsinds hartelijk dank.

grtz
Gandert

gjtje
19/03/07, 10:20
Je Web.config kan niet gelezen worden dus dan hebben de instellinge betreffende customErrors ook geen nut. Je hoster moet de website op asp.net 2.0 zetten, of dat moet je zelf kunnen via een control panel (maar dat zal je hoster dan wel vertellen).
Zodra dit gedaan is zou je foutmeldingen moeten zien mits deze op <customErrors mode="Off"/> staat.

Of je code klopt weet ik niet, zover komt het nu nog niet, maar als het lokaal werkt zal het daar ook wel werken.

gandert
19/03/07, 14:31
Het lag dus degelijk aan het feit dat het geen ASP.NET 2.0 was.
Mijn hosting beheerder heeft het aangepast naar asp.net 2.0.

Bedankt om me te helpen

Maar nu heb ik volgende foutmelding:


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

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: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.

Source Error:


Line 45: ASP.NET to identify an incoming user.
Line 46: -->
Line 47: <authentication mode="Windows"/>
Line 48: <!--
Line 49: The <customErrors> section enables configuration


Source File: d:\accounts\l\o\londen5714\WWW\test\web.config Line: 47


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210



Wil dit dan zeggen dat ik in Visual studio iets moet instellen op ISS of is het iets anders?

gjtje
19/03/07, 15:33
Je hebt je code in een submapje op je webruimte gezet? Dan moet dat submapje als losse applicatie worden aangemerkt in IIS config. Bepaalde onderdelen van de Web.config mogen niet in submappen maar alleen in de root van de applicatie.
Je kan ook de Web.config in de root zetten van de webruimte, Web.config werkt automatisch door naar onderliggende mappen.

gandert
19/03/07, 15:47
Ik voel dat ik er bijna ben.

Heb nu alles in root gezet en ik krijg volgende foutmelding:


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:

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): 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.ProviderBase.DbConnectionPool.GetConne ction(DbConnection owningObject) +437
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.Data.Common.DbDataAdapter.FillInternal(Data Set dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +121
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +137
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +83
System.Web.UI.WebControls.SqlDataSourceView.Execut eSelect(DataSourceSelectArguments arguments) +1770
System.Web.UI.DataSourceView.Select(DataSourceSele ctArguments arguments, DataSourceViewSelectCallback callback) +17
System.Web.UI.WebControls.DataBoundControl.Perform Select() +149
System.Web.UI.WebControls.BaseDataBoundControl.Dat aBind() +70
System.Web.UI.WebControls.GridView.DataBind() +4
System.Web.UI.WebControls.BaseDataBoundControl.Ens ureDataBound() +82
System.Web.UI.WebControls.CompositeDataBoundContro l.CreateChildControls() +69
System.Web.UI.Control.EnsureChildControls() +87
System.Web.UI.Control.PreRenderRecursiveInternal() +41
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210

Weet je hierop een oplossing

gjtje
19/03/07, 16:42
Dan moet je even met je hoster babellen waar je de database moet zetten, misschien ondersteunen ze user attached databases wel niet.
Normaal gesproken zet je databases ook in App_Data, dan kan je in je web.config App_Data\database.mdf als pad gebruiken.
IIS zal ook automatisch deze map afschermen zodat men het bestand niet kan downloaden.

gandert
20/03/07, 10:46
Ik heb voor de zoveelste keer gebeld naar mijn hostingbeheerder en nu zeiden ze opeens dat mijn hosting pakket geen MS SQL server ondersteunt.

Dit was dus het grote probleem.

Nu ben ik dan verlopig overgestapt naar MS Access en daar lukt het direct om het online te plaatesen.

Nu had ik nog 1 vraagje.

Moet ik nu die Access database ook in een App_data mapje steken?

En ik moet er dan niets meer aan doen om deze te beveiligen he (juist in dit mapje steken, toch) ?


Alvast bedankt voor uw hulp

ps: kheb dan nog een probleempje zie onderstaande link:
http://www.webhostingtalk.nl/webhosting-forum/115055-enkel-eerste-10-rijen-zichtbaar-van-access-database.html#post838781

gjtje
20/03/07, 10:55
Ja, databases en andere databronnen zet je in App_Data, alle standaard App_ mapjes zijn beschermd.