ASP.NET Website Project

C

coosa

Dear all,

When i create a website using Visual Studio 2005 i have an option to
choose based on the local file system or the http:// address;
For the local file system, when i later run my web site, the asp.net
development server starts and it assigns a random port to the web
server while for the second option by choosing a http:// address for
the web site project, no random ports will be assigned.

More convenient for me is let people access my website without the
random port, but my problem is:
Even though i specify the same connection string for both projects, i
can't view if i created the project with http:// file system! i always
get this sql exception: select permission denied on object ........ for
that particular view!
It seems that if the asp.net development server was not started and did
not assign a random port, then i have no permissions!
My assumption then, is that by an addrsss with default port 80, a
different computer account is assigned; i guess NT AUTHORITY\NETWORK
SERVICE, else it would be DOMAIN\ASPNET computer user!

I just simply have no clue how to make my site have no assigned random
ports such as http://localhost:3046/MyProj/Default.aspx, but at the
same time that i would have enough permission to access my DB.

I appreciate your response

Best regards
 
E

Erik Funkenbusch

I just simply have no clue how to make my site have no assigned random
ports such as http://localhost:3046/MyProj/Default.aspx, but at the
same time that i would have enough permission to access my DB.

This has nothing to do with random ports. When you do an HTTP site, then
your code is running under IIS. If you do a filesystem project, then it's
running under the Development server (Cassini). The development web server
runs as the account you are logged in with, while IIS runs as the OS
defined user (under XP, this would be (LOCALHOST)\ASPNET for asp.net code).

If your connection string is using integrated authentication, then you need
to give whatever account you are using access to your database. If you're
using a username/password then you have to give that user access.

Since you mention domains. What's probably happening here is that your SQL
server is on a seperate machine, and you're giving your own domain user
account permission. This works in Cassini, but fails with IIS because IIS
uses a local machine account by default.
 
C

coosa

"If your connection string is using integrated authentication, then you
need
to give whatever account you are using access to your database" ...
My Connection string includes: "Integrated Security=True"; Besides, my
ASPNET account in the database is already assigned enough permission to
perform all possible operation i require for my application.
 
J

Juan T. Llibre

re:
I just simply have no clue how to make my site have no assigned random
ports such as http://localhost:3046/MyProj/Default.aspx


To specify the Web server for an already-created Web site,
open your local website with VS.NET and, in the Solution Explorer,
right-click the name of the Web site for which you want
to specify a Web server, and then click Property Pages.

In the Property Pages dialog box, click the Start Options tab.
Under Server, click "Use custom server".

In the Base URL box, type the URL that Visual Web Developer
should start when running the current Web site.

You can use localhost, your machine name, or an assigned domain name for your IP.

From that point on, the VS.NET IDE will not use the internal web server,
but will use IIS to open your pages, i.e., if you are working on default.aspx,
using localhost, it will be opened as : http://localhost/default.aspx and, if you are
working in the myapp directory, it will be opened as http://localhost/myapp/default.aspx .

If you also want to run an application directory as if it was the home directory,
follow the instructions given by Scott Guthrie in this blog :

http://weblogs.asp.net/scottgu/archive/2005/11/21/431138.aspx

It's a real simple, although not very well known, workaround.
 
C

coosa

Thanks alot; it helped alot but still port 80 will not work with the
debugger; any idea why?
 
J

Juan T. Llibre

If you mean the example you requested :
I see this in my university or any intra net enviroment such as the
faculty of information technology address as: http://fit/

that's just the machinename of the server, recognized by your Windows network.

You can connect to the web server of any machine in a Windows network,
running a webserver on port 80, by specifying its machinename in the http address :

http://machinename/
 
J

Juan T. Llibre

re:
is it possible to map a certain http address such as
http://localhost:8080/ to http://machinename:80/ ?

No. You cannot map a port to another port.

If you use http://localhost:8080/ it will be the same as http://machinename:8080/
If you use http://localhost:8081/ it will be the same as http://machinename:8081/
If you use http://localhost:800/ it will be the same as http://machinename:800/

You can create any number of websites which use different ports, until you run out of ports.

re:
is the port 80 a reserved port?

No, but it *is* the default port for most webservers, IIS included.

re:
can it be shared?

No. Web servers capture their assigned port and don't allow other software to run on it.
 
C

coosa

Ok, this is my final question and i will stop bugging you after that
with all the appreciation for your time you've spent to assist me;

I wanted to switch back to to the http:// project location selection
instead of the local file system choice;
So i have an understanding that i will not be using the integrated
windows user account and that the DOMAIN\ASPNET machine account will be
instead used by IIS.
In my connection string i added those lines in my web.conf file:
<connectionStrings>
<add
name="MyConnectionString"
providerName="System.Data.SqlClient"
connectionString="Data Source=127.0.0.1;Initial
Catalog=MyDb;Integrated Security=SSPI; uid=sa; pwd=mypassword"
/>
</connectionStrings>
In my SQL Server Configuration Manager I allowed the "TCP/IP" and
"Named Pipes" Protocols.
However, when I try to execute a query through my browser i receive the
following sql exception:
"{"SELECT permission denied on object 'TableView', database 'MyDb',
schema 'dbo'."}"
Any idea?
 
J

Juan T. Llibre

re:
However, when I try to execute a query through my browser i receive the
following sql exception:
"{"SELECT permission denied on object 'TableView', database 'MyDb',
schema 'dbo'."}"

That is a *SQL Server* permission problem, not an ASP.NET or an IIS web server problem.

You need to make sure that the account which you are using to access
the database has read/write/change permissions for the database's objects.

If you are using Integrated Security you *still* need to add the user account which
ASP.NET is running as ( usually DOMAIN\ASPNET for Windows XP ) to the
database's users...and assign the appropiate database permissions for all the objects
which you want the account to access.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,140
Latest member
SweetcalmCBDreview
Top