How to configure ASP.NET site on IIS 7.0 - asp.net

I found a lot of articles on internet about "Deploying ASP.NET website on IIS 7.0" and now i know that how to do it.
But unfortunately when i set website on the IIS, i get another error! At the first i got "IIS APPPOOL\TradeSite" error. but, when i changed IDENTITY of related Application Pools to LOCALSYSTEM it solved. After that i got new error message with this specification:
Server Error in '/' Application.
Cannot open database "TradeSite" requested by the login. The login failed.
Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.
please help me how to fix this problem.
i add sites with this method:
copy published project to wwwroot folder of IIS
Add new web site in IIS and Set their port to a unique port number ex:8090
Change .Net framework version from 2.0 to integrated 4.0
Change process model identity to LOCALSYSTEM from advance setting menu
that's it. it was all the work that i did.
also, I read somewhere that you should open an connection to SQL, i don't know was it a correct solution or not, but i did it but again nothing changed.
Also i tested on both Server and Local IIS but the result was same.
it will be my pleasure that anyone help me on this issue.
Thanks in advance.

Is your TradeSite db hosted in SQL Server? If so, open up the database in SQL Server Management Studio, select Security, and ensure that Network Service has access to at least read from the database.

Related

IIS 10 getting 401 unauthorized

Deploying an asp.net project on local IIS server as a release version. Getting 401 unauthorized error on API call (allow anonymous enabled). Server runs with administrator user principal. This principal has all the permissions. And the project declared as application with correct .net library. The only thing I can't change is read only flag on the project directory. Anyone can help? Nothing in google resources worked...
Update: After a lot of searching and digging, I found a solution:
IIS Application basic settings - The default settings is to run application with Application pool user, which is usually limited with it's files access permissions. So the idea is to run application with administrator user.
Run as - enter administrator user name and password
Application pool type - The default application pool type is 2 and sometimes new .NET libraries are not accessible. So you have to add all the missing ASP.NET types to IIS.
Usually ASP.Net version suppose to be classic, in this case application works fast. Otherwise application refresh time may take long period.
Local folder permission - add local administrator, that you defined on IIS settings, and grand him all permissions to the folder recursively
SQL Server Management- the default server authentication is Windows Authentication, make it SQL Server and Windows Authentication mode
Add new user to the server and grand him all the permission to the database
Add this user to database Users and change the SQL connection string at the project accordingly. This way you prevent application pull trying to connect with database with it's user
Just posting this here as I went around in circles trying to diagnose an intermittent 401 error.
I had a virtual sub directory within the web application that referenced an external folder which was out of the directory tree so had different folder permissions.
Any scripts that referenced this folder failed - while others ran completely fine.

ASP.NET error log

Every time the ASP.NET application in question throws an error the Global.asax writes to an error file: logs\error.log. The ASP.NET applications works using Windows authentication.
I am able to write to the log file when debugging using Visual Studio, however it does not work when the application is deployed in the live environment. How do I find out what user account I need to give access to: logs/error.log?
The application is deployed on a Windows 2003 Server with IIS6. Microsoft.NET 3.5.
You would have to give the required permissions to the network service account. This link might be able to help you out.
Windows Server 2003 defaults to the "Network Service" account.
This can be verified by opening IIS (expand the computer if needed), expand the "Application Pools" folder, right click on the pool used by your web app, and go to the Identity tab.
FYI: Windows Server 2008 uses the IIS_IUSER instead of Network Services.
I hope that logs folder is a virtual directory setup outside the web site directory.
Otherwise every time you deploy the entire solution you will overwrite the logs folder and its content.
Microsoft has a tool for monitoring file access that can be useful for troubleshooting permission issues.
Process Monitor - http://technet.microsoft.com/en-us/sysinternals/bb896645
You will also want to check if your application is using windows authentication & identity impersonation since that can change the identity the application is executing with when enabled.

ASP.NET virtual directory error

I set up virtual directory in IIS 6. The asp.net setting for my application pool is 4.0.
When I try to access my site I get the following error.
Server Application Unavailable
The web application you are attempting to access on this web server is
currently unavailable. Please hit the "Refresh" button in your web
browser to retry your request.
Administrator Note: An error message detailing the cause of this
specific request failure can be found in the application event log of
the web server. Please review this log entry to discover what caused
this error to occur.
When I check the event application log I get the error below.
Failed to execute request because the App-Domain could not be created. Error: 0x80070005 Access is denied.
It looks like some sort of permissions error but I can't figure out what. Anyone have any ideas?
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
Use ProcMon from Microsoft to trace the file access of your web server worker process (aspnet_wp.exe on XP, w3wp.exe on Win7, 2003, 2008). If you filter where Process Name contains one of those two EXE names, you will eventually see an ACCESS DENIED entry in the status column. This will tell you what folder/file that your web server app cannot access or open.
Tip: for easier reading of results, turn off the registry and network tracing in ProcMon before doing your test.
You can try giving the IIS_WPG group (or whatever group the application is running as) read/write access to you app directory and see if it helps.
Your pool is set as .NET 4 framework but is your application set to using .NET 4?
Verify the ASP.NET tab is set to correction version on your virtual directory properties:
Also check to see that your ASP.NET user has the correct access by:
Right click the website folder in IIS
Select Permissions
Select Network Service
Permit read access to the user that the ASP.NET process runs as.
You are probably using a custom user or else the persmissions would most likely be correct out of the box.

ASP.NET App Exports to Excel (or not in this case)

Exising .net 2 app migrated to .net 4 and moved to an IIS7 Windows 2008 R2 server.
We used to be able to run some code on the web page to export some stuff to excel.
Now, when we do... we get the following error:
The machine-default permission settings do not grant Local Activation permission for the COM Server application with CLSID {00024500-0000-0000-C000-000000000046} and APPID
Unavailable to the user d"omain\username" SID (S-1-5-21-2084383492-816144152-925700815-4150) from address LocalHost (Using LRPC). This security permission can be modified using the Component Services administrative tool.
Any thoughts?
I did wonder if it may be to do with the authenticated user being on a different domain to the webserver - where we see this error??
Try following this resolution:
Microsoft Support
I believe that the basics of the error are the same. The user you are trying to run the DCOm component as does not have permission to start it.
Restarted the web server and this error no longer appears... I get another error when I try and do the workbook save... I'll post another question on that.
Thanks for your help

Connecting to SQL with ANONYMOUS LOGON since switch to IIS7

I've recently had my PC upgraded to Vista, which means it includes IIS7. The problem is that the ASP.NET website we're working on doesn't work anymore. I get an error because the application is trying to connect to the SQL Server with NT AUTHORITY/ANONYMOUS LOGON instead of my domain user, and anonymous isn't authorized. I've tried several things, but no solution yet:
- install and enable the 'IIS Metabase and IIS 6 configuration compatibility'
- enable Windows Authentication for this website
- created a different Application Pool with managed pipeline mode set to Classic
- enabled IIS6 WMI compatibility and IIS6 management console (getting desperate here)
In our web.config there's and in our machine.config there's . I've tried putting impersonate to false and entering my domain user and password in the machine.config (it used to be like this) but that didn't help either.
Are there things I'm missing? Has anyone else had a similar problem?
How does your application authenticate with SQL Server? Does it use SQL or Windows Auth? I hope you are trying to use Windows Auth. In that case, your IIS worker process should be running under that Windows user account. If not, it should at the least impersonate a Windows user account that has necessary access rights to SQL Server. If you have impersonation enabled and if you are using the right Windows user account and if SQL Server authenticates using Windows auth and if you are still unable to access SQL Server, you may be running into the classic double hop issue. In other words, you are trying to authenticate to IIS once and you are using the same crdentials to authenticate to the SQL Server over a network next(which is your second hop) and Windows does not allow that for security reasons.
I believe I have found a/the solution. At least it's working now. This is what I did:
The website is now running in a seperate application pool with Managed Pipeline mode set to classic, Load userprofile set to False and Identity set to custom and using a domain user (and password) that has access to the database.
Under 'authorization' of the website itself, I have Anonymous set to enabled and ASP.NET impersonate set to disabled.
in the web.config of the site is also set.
Credit where it's due, this site helped me.
I'm sorry to say I can't look into the issue any further. Indeed, it probably is something with the way we connected to SQL Server (Win Auth) because we've changed it now. Now we connect with username and password in the connection string and it's solved.
So I can't really say if you provided the answer, msvcyc, but I did vote on your solution. Thanks for the time and trouble.
Well, I recommend you migrate to Integrated mode if there is not too many troubles to enjoy the innovation it brings. :)
http://mvolo.com/blogs/serverside/archive/2007/12/08/IIS-7.0-Breaking-Changes-ASP.NET-2.0-applications-Integrated-mode.aspx

Resources