Security Exception while running an ASP.NET on deployment server - asp.net

I am trying to run a WebAPI on a deployment server connected via a Remote Desktop link, but when I try to connect to the website via a browser, I get the error of:
Security Exception
Description: The application attempted to perform an operation not allowed by the security policy.  To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.
Exception Details: System.Security.SecurityException: The source was not found, but some or all event logs could not be searched.  Inaccessible logs: Security.
Source Error:
An unhandled exception was generated during the execution of the current web request.
I can run and access the website fine when it is running from Visual Studio, its just when it is on the deployment server.
So far, I have tried:
Adding a <trust level="Full" /> element to web.config
Place the site in its own application pool in IIS (It already was).
The information in this article
Made changes to my code to see if it was the code itself which was causing the issue (I don't think it was, any request method such as POST and GET returned the same issue as above. I even tried other directories/URLs, I still got the error.)
Remove and re-publish the site several times.
Is there something which I am doing wrong which I'm not realising? Is there another way which I can solve this issue?
Any help would be appreciated.

Related

Custom Error mode set to "RemoteOnly", debugging locally still shows custom error page

In two of our ASP.Net Web Applications, in the Web.Config file, we've set the Custom Error redirect to our custom error page, and set the mode to "RemoteOnly" so that when we debug locally we see any unhandled exception message displayed on the "Yellow Screen of Death" - "YSoD".
This week, we discovered that when an unhandled exception is encountered, all of a sudden we're getting our custom error pages, instead of the exception details in the "YSoD".
This applies to only two, of the several applications we're running. I've searched high and low for a similar problem/solution, and haven't found much.
I'm trying to determine if this is an Application, IIS, or Visual Studio configuration problem. It just started happening, and there were no significant changes made to the server, etc., to potentially explain the problem. We have enabled IIS Failed Request Tracing, but I couldn't find anything associating this with our problem.
Given this information, what can cause this sudden change in behavior?
The back-end is a SQL Server database, using Windows Authentication, on an AWS VPC.

Why does "start debugging" cause an immediate HTTP404 error?

Setup
I recently changed computers, and pulled down a codebase that had been working before. I created the application using the "Create Virtual Directory" button in Visual Studio, and I can confirm that the application shows up in IIS as an application. I know this codebase works because it's in production; I've just changed development environments.
The Problem: HTTP 404.0
When I run the application, the debugger launches and a browser tab opens to HTTP 404.0
The problem resembles this unanswered question, except I'm using IIS 10 instead of 8.5: https://serverfault.com/questions/702235/iis-8-5-instant-404-0-error-on-mvc-site
Details:
Detailed Error Information:
Module IIS Web Core
Notification MapRequestHandler
Handler StaticFile
Error Code 0x80070002
Requested URL http://localhost:80/OURMVCSITE
Physical Path D:\OURMVCSITE
Logon Method Anonymous
Logon User Anonymous
What I've tried
Many StackOverflow answers point to issues with the RouteConfig or Global.asax.cs. I've set breakpoints in both; neither class is ever executed.
The app pool is the default app pool running in Integrated mode under the Network Service user, and Network Service has access to every file and folder in the directory.
Searching for answers in general is somewhat difficult because most results are about creating custom 404 error pages for when users incorrectly enter a URL.

Azure Web App suddenly returns 401.72 for all request

I have a problem which is similar to this one, but not quite.
We have a solution with two Azure Web Apps, built and deployed by Visual Studio Online. It has been working just fine for a few months, but suddenly all requests end in a 401.72 response:
HTTP Error 401.71 - Unauthorized You do not have permission to view
this directory or page.
Most likely causes: The authenticated user does not have access to a
resource needed to process the request.
Things you can try: Create a tracing rule to track failed requests for
this HTTP status code. For more information about creating a tracing
rule for failed requests, click here.
Detailed Error Information: Module EasyAuthModule_32bit
Notification AuthenticateRequest Handler
ExtensionlessUrlHandler-Integrated-4.0 Error Code 0x80004005
Requested URL https://[appname]:80/ Physical Path
D:\home\site\wwwroot Logon Method Not yet determined Logon User
Not yet determined
More Information: This is the generic Access Denied error returned by
IIS. Typically, there is a substatus code associated with this error
that describes why the server denied the request. Check the IIS Log
file to determine whether a substatus code is associated with this
failure. View more information »
Microsoft Knowledge Base Articles:
As far as I can figure out, no relevant configuration changes has been done.
Restarting the Web App and redeploying the solution didn't solve the problem
As it happens, we were due to recreate the environment anyway, and after this was done, the same deployment setup (with updated target) deployed successfully and it's working fine on the new Web App intsance.
Even if we now have a working environment, we'd really like to know what happened, so we can be sure it doesn't happen again.
Can anyone shed any light on this?
You had easy auth turned on. Do you expect it to be turned on? That appears to be causing the issue.
If you don't intend for it to be on, please turn it off via either portal (old|new) by navigating to your Web App and finding it in your settings.
If you do intend for it to be on, you need to check your configuration to make sure you've properly set up AAD. Maybe the App Configuration within AAD has changed?
If neither of those things helps, let me know.

asp.net can't access network drive folder

I am trying to debug an asp.net code in VS 2012.
i press the debug tab ->start debugging. the debug is in web browser explorer.
So a webpage is opened with this address: http: //localhost:27970/hellow.aspx
on this page i have an file uploader. and the page tries to save it. It is supposed to go to a network drive D:\ and save it there. here it fails and i am getting this error:
Access to the path'D:\upload_files\WebTesting\Test\5_12_2013_13_50_32_material.txt' is denied.
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.
ASP.NET is not authorized to access the requested resource. Consider granting
access rights to the resource to the ASP.NET request identity. ASP.NET has a base
process identity.
I also want to mention that this app is already working and i am just wanted to add some features. When i try to do the same actions in the website(before my changes) ,the file uploading has no problem, the problem is only in the debugging process.
I guess it has something to do with IIS. but i am not familiar with the IIS at all.
Any ideas?

ASP.NET Web Application Error

I have an application with the main and 2 sub pages. The main page works and one of the sub pages work fine. But the other sub page gives me an error:
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 tag within a "web.config" configuration file located in the root directory of the current web application. This tag should then have its "mode" attribute set to "Off".
When trying to run on my local, i get
An error occurred while accessing the resources required to serve this request. The server may not be configured for access to the requested URL.
These were working fine a week ago and this problem is sudden. help please.
You are facing this issue because the SubPage you are getting error on accessing might be under some security. The error you have described comes on a page which is not accessible to the anonymous user.
You must check the Web.config firstly to see if there is some Location Access permissions defined for that Webpage and ensure that they are correctly defined.
You may read about more to this problem by a previous Answer.
web site configuration

Resources