Toon posts:

[asp.Net] Database Connect probleem

Pagina: 1
Acties:
  • 71 views sinds 30-01-2008

Verwijderd

Topicstarter
Ik heb Sql Server 2000 eveluatie versie
Ik heb een simpele webservice die connect naar een database echter krijg ik eerdere keer een error bij SqlConnection.Open();

Ik krijg deze Error
Server Error in '/DatabaseTestWebservice' Application.
--------------------------------------------------------------------------------

Login failed for user 'ORANGESPOT\ASPNET'.
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: Login failed for user

Ik heb op msdn gekeken en daar maken ze op dezelfde wijze een connectie zoals ik doe vanuit de Server Explorer je gewenste database/table en in de form slepen.

is iemand bekent met dit probleem??

[edit]
Precies hetzelfde werkt wel in in een normale App
en trouwens gebruik C# als .net taal

Verwijderd

heeft je 'ORANGESPOT\ASPNET' user wel rechten op de database dan?

  • hopakee
  • Registratie: December 2001
  • Laatst online: 25-01-2023
Heb je wel je Username en password in de connectionstring staan?
het lijkt erop of er gebruik wordt gemaakt van de ASP.NET User voor
de connection met de database.

Verwijderd

Topicstarter
het vreemde is dat ik connect met OrangeSpot en hij geeft een error voor ORANGESPOT/ASPNET en in de connectie string staat niks over ASPNET

Verwijderd

nee dat komt omdat je op SQL server aanlogt met je Windows-identiteit. En aangezien ASPX-en onder het ASPNET account draaien loggen die daarmee aan.
Normale applicaties draaien onder het account waarmee je ingelogd bent en dat is vast administrator op je bak.. daarom werkt het dan wel.

Ik zou een SQL-server identiteit gebruiken. Zoals de user 'sa' bijvoorbeeld.. daarvoor moet je wel je connectstring aanpassen.

  • cannibal
  • Registratie: Maart 2001
  • Laatst online: 13-05 09:45
hoe ziet de connectionstring eruit welke je gebruikt voor het aanmelden op de database.

Verwijderd

Data Source=sqlservernaam;Initial Catalog=databasenaam; User ID=sa;Password=jewachtwoord;

  • cannibal
  • Registratie: Maart 2001
  • Laatst online: 13-05 09:45
dat model gebruiken wij hier iig ook ja. zou moeten werken.

Verwijderd

Topicstarter
hoe maak je zo'n sql identiteit aan want ik krijg iedere keer not associated with a trusted sql connection

  • cannibal
  • Registratie: Maart 2001
  • Laatst online: 13-05 09:45
sa zou er standaar bij moeten zijn, is gedaan tijdens installatie. of heb je bij installatie gekozen voor windows-authentication ??

Verwijderd

Topicstarter
ja klopt dus ik moet gewoon opnieuw installe

  • cannibal
  • Registratie: Maart 2001
  • Laatst online: 13-05 09:45
of proberen of je het met je windows-authentication lukt. maar daar heb ik niet zoveel ervaring mee.

  • gorgi_19
  • Registratie: Mei 2002
  • Laatst online: 06:53

gorgi_19

Kruimeltjes zijn weer op :9

http://www.asp.net/msde/default.aspx

En dan stap 4:
Assign Permissions for the ASP.NET Worker Process
Open an MS-DOS Command Prompt. Generally, this can be found using:

Start Menu -> Run
Type in: cmd.exe or command.exe depending on your OS

Inside of the MS-DOS Command Prompt you'll make use of a utility called OSQL to manage your new MSDE instance. Specifically, you'll be assigning permissions to the ASP.NET worker process account. The following commands will need to be run to properly assign permissions:


osql -E -S [SERVER] -Q "sp_grantlogin '[USERNAME]'"
osql -E -S [SERVER] -d [DATABASE] -Q "sp_grantdbaccess '[USERNAME]'"
osql -E -S [SERVER] -d [DATABASE] -Q "sp_addrolemember 'db_owner', '[USERNAME]'"

The following variable replacements are defined for the above statements:

[SERVER]
This should be the name of your database server. When you installed MSDE you got two choices. The first was to install a default instance of MSDE. If you chose this method then your instance name will be [MACHINENAME] or [MACHINENAME]\NetSDK. The second choice was to install to a custom instance, [MACHINENAME]\[CUSTOMINSTANCE].
[MACHINENAME]
When connecting to a SQL server, you can connect to either you machine or a remote machine using the OSQL tool. If you installed to your local machine then you can use the special name (LOCAL) or localhost to connect locally, or the actual name you've assigned to your machine. For remote machines, you'll need to specify a DNS name (sql1.mydomain.com), an IP address (192.168.0.1), or the NETBIOS name of the machine on your local network (SQLSERV1).
[CUSTOMINSTANCE]
Custom instances are a great new MSDE/SQL 2K feature. It allows the same machine to host multiple instances of the database server for testing and migration purposes. It also means applications can have their own server rather than simply having a database within an existing server. Various products shipped by Microsoft use the instance names NetSDK and VSDotNet, and so you may have databases with these names on your machine. You may have also installed using a custom instance name of your own, in which case you'll need to specify that when connecting to or modfiying the server.

In addition, you can use net commands from the command line in order to discover the SQL Servers on your machine assuming they are running.

net start

The above command will list all currently running services. You'll need to search the list for services starting with MSSQL (the list is in alphabetical order). If any of the services contain a $ sign, followed by additional naming information, then the additional information after the $ sign is the instance name.
[DATABASE]
Each server you install will have multiple databases. You'll need to grant the worker process priveleges to any of the database it will be working with. Some common database names are master, northwind, pubs, grocertogo, AspNetForums, and portal.
[USERNAME]
The username will be the user you are assigning permissions for. You'll probably need to assign permissions to the [MACHINENAME]\ASPNET account. If you are using SQL security, or you are signing in using NT authenticated users that aren't the ASPNET account, then you'll need to replace the username with that information instead, examples include (sa, MyCustomDBUser, [MACHINENAME]\MyLogin, and DOMAIN\MyLogin).
Ik gok dat dit een oplossing is.

Digitaal onderwijsmateriaal, leermateriaal voor hbo


Verwijderd

Topicstarter
Ik Geloof dat opnieuw installe ook een oplossing is aangezien er niks in de database aanwezig was

maar bedankt voor de hulp & moeite

[edit]
alles werkt nu naar wens :)

Verwijderd

je hoeft niet opnieuw te installeren hoor, gewoon settings van de sql server aanpassen naar Mixed authentication.... :-)

Verwijderd

Topicstarter
Tis nu al gebeurt en het was geen moeite aangezien er niks in de db stond

Verwijderd

hoi sorry voor ophalen van dit oude topic maar heb een probleem met toegangsrechten tbv van een .net cursus. Ik moet de ASPNET user toegang geven tot twee databases (contacts en northwind) Dmv van de drie bovenstaande command line statement met sql gaat northwind prima.
Vervolgens wil ik de contact database doen en typ ik het volgende:

osql -E -S -DELL -d contacts -Q "sp_grantdbaccess 'DELL\ASPNET"

vervolgens krijg ik de volgende melding:

Msg 15063, Level 16, State 1, Server DELL, Prcedure sp_grantdbaccess, Line 116
The login already had an account under a different user name

Ik heb MSDE 2000 geinstalleerd om gebruik te kunnen maken van de SQL databases. Weet iemand hoe ik ook de user rechten kan geven aan de contacts database????

alvast erg bedankt

  • gorgi_19
  • Registratie: Mei 2002
  • Laatst online: 06:53

gorgi_19

Kruimeltjes zijn weer op :9

skippie, je probleem heeft weinig te maken met het eigenlijke, originele probleem. :) Daarnaast is je probleem softwaregerelateerd en heeft het weinig met programmeren, maar eerder met configureren te maken. :) Open daarom een 'vers' nieuw topic in Software Algemeen, eventueel met een verwijzing naar dit topic voor wat je evt. al hebt geprobeerd :)

Dit topic kan alleen verwarring opleveren, als men gaat reageren op eerdere, oudere posts. Daarom doe ik deze dicht :)

Digitaal onderwijsmateriaal, leermateriaal voor hbo

Pagina: 1

Dit topic is gesloten.