N-Tier / Class Libraries

  • Thread starter Thread starter bh
  • Start date Start date
B

bh

This is the first time I've tried separating my code into a separate data
layer, located in a class library. The class library compiles fine, and
then I reference it in my asp.net application. When I run it from Visual
Studio it works, however, when I run it from IIS
(localhost/application.aspx), I get the following error:

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
'DOMAIN\SERVERNAME$'.

The line of code highlited is the one which calls the data access layer to
process the login credentials.

Thank you for any help you can provide on this. I'm very much a newbie to
N-Tier stuff, but would really like to learn how to reduce hard-coding
everything over & over :)
 
You're probably using "Integrated" or "Trusted" authentication, which relies
on the user who is running the code.

as you found out, there is a specific user under which IIS runs.

Either switch to sql authentication or give that user proper permissions.

www.connectionstrings.com has several options for which type of connection
string to run.


Layered and Tiered are words that get thrown around alot.

http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!158.entry
Compare it to someone else's work to see if actually are using Tiered
development.

Good luck.
 
Thank you for your reply. You are right. While I was using SQL
Authentication in the method I was calling from the app, that method called
another one, which was using integrated authentication. Thank you also for
sending the N-Tier sample. Unfortunately, WCF is way ahead of where I'm at,
right now, and I'm also still using SQL Server 2000. You may be right about
this not being true "N-Tier". Unfortunately, I'm the only "developer"?? in
this IT group, and no one here knows anything about .NET My main experience
was with Access, but I've been assigned to develop a web-based application
for all of our employees to use. The whole idea is overwhelming to me.
I've been doing SQL stored procedures for years and have a little experience
with simple .asp and ASP.NET pages that hit SQL databases, but this is my
first true app. I thought that N-Tier simply meant separating your data
logic from your business logic. Thank you for your help.

bh
 
Back
Top