SQL database on Visual Studio server error when publish - c#

I have created a website on visual studio and I have added an SQL database onto it. I am using DetailsView and GridView to display the data. It works perfectly before I published the website using GoDaddy. I am assuming there is some security issue I need to fix. Any suggestions or help would be great. Thank you.
Here is the error:
Server Error in '/' Application.
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: Request failed.
Source Error:
[No relevant source lines]
Source File: App_Web_lfy0dq0l.0.cs Line: 0
Stack Trace:

If you are not make sure you are running Visual Studio as Administrator. I'm getting this from the application line in your comment.
Server Error in '/' Application.
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: Request failed.

Related

Configuration Error on Updating Web.config

I would like to update the web.config file by C# in windows container.
The following is a function of updating web.config in C#
private void UpdateWebConfigFile()
{
var configuration = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~");
var section = (System.Configuration.ConnectionStringsSection)configuration.GetSection("connectionStrings");
var defaultConnection = section.ConnectionStrings["DefaultConnection"].ConnectionString;
section.ConnectionStrings["DefaultConnection"].ConnectionString = Environment.ExpandEnvironmentVariables(defaultConnection);
configuration.Save();
}
but an error occurred in configuration.Save(); that I get the result as following
Server Error in '/' Application.
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: An error occurred loading a configuration file: Access to the path 'C:\inetpub\wwwroot\tynfsgbl.tmp' is denied.
Source Error:
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.
Source File: C:\inetpub\wwwroot\web.config Line: 0
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.3535.0
My question is How to update Web.config in the application of Windows Container?
Thank you!
Containers are by design intended to be immutable, and as such, the default user is set to a non-admin account which will not have permissions to modify the IIS directoy.
While you can modify the runtime user to be an admin, this would present another issue due to the way that IIS inside a container is montiored. Changing the web.config would cause IIS to reset the pool, which docker would treat as a process crash and stop the container.
Either you should modify the web.config as part of the container build, or you should use environment variables directly rather than trying to write them into the web.config when the container is running.

WebForms application - 'The trust relationship between this workstation and the primary domain failed.'

I have scoured the internet for this particular error and I've found similar ones but nothing that matched my problem. I have a WebForms application that continues to give me the error below.
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Could not create Windows user token from the credentials specified in the config file. Error from the operating system 'The trust relationship between this workstation and the primary domain failed.
It highlights the line: (I've replaced the username and password with generic text for this post.)
<system.web>
<identity impersonate="true" userName="(Domain\(Username)" password="(Password)"/>
Whenever I change impersonate="false" it just says that LocalHost cannot be found. I'm not sure what the issue is here and I can't seem to get the application to run locally.

The current custom error settings for this application prevent the details of the application error from being viewed remotely

I've deployed the application on Server (HostGator), and on Preview it gives me following error
Server Error in '/' Application. Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the
specific error details below and modify your configuration file
appropriately.
Parser Error Message: This configuration section cannot be used at
this path. This happens when the site administrator has locked access
to this section using from an
inherited configuration file.
Source Error:
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.
Source File:
D:\InetPub\vhosts\accleague.org\admin.accleague.org\web.config
Line: 24
But when same application deployed on another Server, it runs smoothly on 1st try.
Tried every possibility mentioned on internet but unable to resolve the issue.

Compilation Error - Server Error in '/' Application

When hosting the application on local IIS all forms work fine without causing any errors but while hosting the application on the server some forms are showing the 'Compilation Error'
**To remove these error made following updations to the server side.
Restart the application pool.
Enable 32-Bit Application = true on server side.
Still getting the error on the forms.**
Is there any other way to find out the server side compilation errors.
What is exactly the compiler error code 1.
Detailed Error is as follows:
Server Error in '/' Application.
Compilation Error
Description: An error occurred during the compilation of a resource
required to service this request. Please review the following specific
error details and modify your source code appropriately.
Compiler Error Message: The compiler failed with error code 1.
Version Information: Microsoft .NET Framework Version:2.0.50727.8009;
ASP.NET Version:2.0.50727.8015
Please make sure you have installed required windows features to run IIS on your hosting server.
You can do it by following
Control panel >
Program features >
Turn on Windows features on or off
Then on the pop up window, navigate to;
Internet Information Services >
Word Wide Web Services >
Application Dev Features >
Tick all required features (I have ticked all but CGI)
Hope this helps.

Error: Unable to generate a temporary class (result=1) ... When Invoking Methods on a Web Service

Error: Unable to generate a temporary class (result=1) ... When Invoking Methods on a Web Service. I am using VS 2008 C# ASP.NET 3.5. I am invoking a remote webservice to my application.
Server Error in '/' Application.
Server was unable to process request. ---> Unable to generate a temporary class (result=1).
error CS2001: Source file 'C:\WINDOWS\TEMP\6sbkwt2d.0.cs' could not be found
error CS2008: No inputs specified
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.Web.Services.Protocols.SoapException: Server was unable to process request. ---> Unable to generate a temporary class (result=1).
error CS2001: Source file 'C:\WINDOWS\TEMP\6sbkwt2d.0.cs' could not be found
error CS2008: No inputs specified
Source Error:
Line 775: [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/CheckLogin", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
Line 776: public System.Data.DataSet CheckLogin(string uname, string pswd) {
Line 777: object[] results = this.Invoke("CheckLogin", new object[] {
Line 778: uname,
Line 779: pswd});
Source File: c:\windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\14127ae4\96323535\App_WebReferences.u9ldrmk1.0.cs Line: 777
First, credit where credit is due. The OP solved this problem and answers it in the comments section of the question. However, I understand that many people come to StackOverflow and will read through the question, and not look at the comments. Therefore, I'm relaying the above answer here. Be sure to up-vote the question if this is useful.
This problem occurs because the account that is associated with your web service's application pool in IIS does not have read/write permission to the C:\Windows\Temp folder. I have no clue why the account needs access to this folder, but it does. From my casual observation it looks like it just writes an empty file with a random name to the Temp folder.
To solve this problem browse to the C:\Windows folder, and right-click on the Temp folder. Select Properties, and on the Security tab add the account associated with your web services application pool. Hit the OK button, go to IIS and recycle your application pool. This should fix your web service request.
It is worth noting that the circumstances around this error can be a bit deceptive. I've ran into this problem a couple times over 5 years. (I've forgotten about it each time.) The reason why it's not so noticeable is because you can publish a web service, successfully browse to the associated asmx page and see the outline of your web service methods. Furthermore, your Visual Studio project can add a reference to the Web Service and Visual Studio will auto-generate all associated classes for the web service in your VS project.
This gives the impression that everything is working properly until you make your first request to execute a method on the web service. The web service will fail when it begins executing code because it wants access to the temp directory.
Further information regarding this bug can be found at the acknowledged bug report at Microsoft.com.
That happens when your web site doesn't work with Application Pool "DefaultAppPool" and you chose its own pool.
In that case you need to add an user with the name of your pool.

Categories

Resources