Related
I am using Microsoft Visual Studio 2015, I built a simple website with a C# contact form.
When I compile and run on localhost it works perfectly fine. However, when I try to publish it (on smarterasp.net) I am getting an error:
[Win32Exception (0x80004005): Access is denied]
[ExternalException (0x80004005): Cannot execute a program. The command being executed was "..\bin\roslyn\csc.exe"
I have contacted smarterasp.net and they said they dont allow .exe files. I tried to delete csc.exe with ftp from the server but when I do that I am getting the error:
Could not find file "..\bin\roslyn\csc.exe".
How can I solve this issue with the csc.exe that is trying to get included in my project so I can get my this website published?
After hours of researching i came up with the solution.
Since the .NET 4.5 version, Roslyn compilation is the default way of compiling. This means if you create any web application either Web Forms or MVC using .NET 4.5 you get this Roslyn csc.exe compilation pre-installed in your project.
Basically what i needed was to compile and deploy my project without Roslyn or any .exe files on it.
So here is the Solution that worked for me. You can deploy without Roslyn with no change in code:
Open NuGet Package Manager window
uninstall Microsoft.CodeDom.Providers.DotNetCompilerPlatform package and rebuild & republish. (This uninstallation also removes CodeDom configuration from web.config file.)
This will solve your purpose. Basically this will not generate any csc.exe, vbc.exe files inside bin folder.
I hope it works for you too!
I had this issue on Smarter ASP. On the browser file manager in the control panel, navigate to 'Roslyn' folder in bin and set .net permission to read/write. It worked then.
If you actually want to keep the roslyn codegen, you just need to set the permissions on the application's bin folder to allow the ApplicationPool user Read & Execute.
I did this using the explorer Security tab on the folder properties dialog, but you should also be able to do something like:
icacls PATH_TO_SERVICE_BIN /grant "ApplicationPoolUser":(OI)(CI)RX
I found the solution as unchecking "Allow precompiled site to be updatable", on publish window.
Just remove the codedom section from the Web.config, this solves the problem.
Just set rw access for /bin folder in Smarterasp.net File Manager as shown below, restart your app
Just experienced the same issue as the OP when publishing an ASP.net 4.5.2 SPA via web deploy in VS2015.
The solution I found to work was to remove the Nuget package "Microsoft.CodeDom.Providers.DotNetCompilerPlatform".
You could, alternatively, simply remove the system.codedom compiler config section from your Web.config file, which would have the same affect.
Here's how I got it working:
In your control panel, navigate to Security Manager > Allow .EXE Files
Set the value to On (this will let you upload .exe files)
In your Web.config, set full trust (this will let you run them)
<configuration>
<system.web>
<trust level="Full" />
</system.web>
</configuration>
In your publish settings, enable "Precompile during publishing", but in the
Advanced Precompile Settings (the Configure link next to this option), disable "Allow precompiled site to be updateable".
I had the same error and I solved it by enable the permissions of the hosting directory (read/write/delete).
If you need SmarterAsp.Net to allow the uploading of an .exe file to support the features and functionality of your website, you can. Just go to the control panel and turn on "Allow .Exe Files" See below:
In my case I had to do this because I wanted to host an Asp.Net Core website and that absolutely requires an .exe file :-)
tl;dr: Ensure that csc.exe is not zero bytes in size.
Longer answer
To add yet another cause and solution: In my case, I got this Yellow Screen Of Death in my browser:
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 255.
c:\windows\system32\inetsrv>C:\inetpub\wwwroot\bin\roslyn\csc.exe
/t:library /utf8output /nostdlib+ ...
Version Information: Microsoft .NET Framework Version:4.0.30319;
ASP.NET Version:4.7.2558.0
Upon investigation, I isolated the call to csc.exe by executing it inside a CMD window:
c:\inetpub\wwwroot\bin\roslyn\csc.exe
I got this message box:
followed by this line in the CMD window:
Access is denied.
Upon inspecting the files in Windows File Explorer I found out that csc.exe had a size of zero bytes.
I'm unsure at which stage of my deployment script this happens, but after replacing the 0-byte-sized csc.exe with an actual working one, everything works correctly.
The above solutions did not work for me and are not correct, since roslyn is not optional these days.
What worked was ensuring that the pool account had read & execute permissions on the root folder of the web application. You can find the account to grant this permission to by finding the Pool name your web app uses, then Application Pool -> pool name -> Advanced Settings -> Identity.
My VPS host uses non-standard directories for hosting as follows:
c:\home\web.app.name\wwwroot
The web.app.name folder needed the permission.
Updating the nuget package Microsoft.CodeDom.Providers.DotNetCompilerPlatform to the latest version (at that time) 2.0.1 resolved this issue for me without having to grant permissions to the folder or remove the compiler.
We encountered this due to a 3rd party application. MalwareBytes Anti-Ransomeware was actually the culprit that was blocking access. Resolved this with:
Right-click systray icon for MalwareBytes Anti-Ransomeware (not anti-exploit)
Stop Protection
I've recently received some ASP.NET application to test. I must run it on local server. I installed IIS with all components. I copied whole project to c:\inetpub\wwwroot. Catalog structure:
I suppose main file to run is Global.asax, but when i try to run localhost/.../global.asax I get error:
HTTP Error 404.3 - Not Found
Description: The page you are requesting cannot be served because of the Multipurpose
Internet Mail Extensions (MIME) map policy that is configured on the Web server. The page you requested has a file name extension that is not recognized, and is not allowed.
ASP.NET is completely new technology for me. I guess there is very easy solution ;)
You need to create a virtual deirectory on IIS ad the publish your site there. You can find complete process here:
http://msdn.microsoft.com/en-us/library/1y1404zt(v=vs.90).aspx
http://www.codeproject.com/Articles/28693/Deploying-ASP-NET-Websites-on-IIS
Seems you are using MVC. so check this : http://www.asp.net/mvc/tutorials/deployment/deployment-to-a-hosting-provider/deployment-to-a-hosting-provider-deploying-to-iis-as-a-test-environment-5-of-12
You have to create Virtual Directory of your application.
Check out this Reference.
You can directory publish your web application on IIS.
Here is walkthrough reference.
There are number of posts on this and I have tried many a things by now. But to no avail. Myself a Winforms Developer basically, started working on this Web stuff few days back as my company is taking Web initiatives.
I have a ASP.Net project and I want to host it on local IIS. In Project properties -> Web settings I chose Use Local IIS Server and gave a url as localhost/MyApp. I tried accessing it on my firefox browser and received error as HTTP Error 503. The service is unavailable.
Previously I got many other errors and I one by one fixed them all. But struck with this one. These are the settings I have in my project
Application Pool set to ASP.Net v4.0 Classic
App Pool Enable 32 bit Application property is true
App Pool is started
Project build property set to Any CPU for Target framework
But I would like to mention a weird behavior. Following is something that I am facing
Application Pool is Started
I try to access my local website (by giving url as localhost/MyApp)
I receive the error as HTTP Error 503. The service is unavailable
Application Pool is Stopped
I have seen following link and I have already tried it. For the above behavior I reached here. According to this link, Computer name should not have . in it. I don't have any . in my Computer name but do have - in it. Also my domain name contains . in it. Moreover I can't change these settings as its my office laptop and our TFS settings are bound to our Domain and Computer Names.
Can anyone help me to understand whats happening? Please guide me. Thanks.
Edit
I have following code in Global.asax. Application_BeginRequest method is empty in same file.
protected override void Application_Start(object sender, EventArgs e)
{
base.Application_Start(sender, e);
String _path = String.Concat(System.AppDomain.CurrentDomain.RelativeSearchPath, ";",
System.Environment.GetEnvironmentVariable("PATH"));
System.Environment.SetEnvironmentVariable("PATH", _path, EnvironmentVariableTarget.Process);
MyAppLog.Initialize();
MyAppLog.WriteMessage("Application Started");
}
Update
As per the suggestions in Comment, I am able to run the website from Cassini.
One possible reason this might happen is that the Application Pool in IIS is configured to run under some custom account and this account either doesn't exist or a wrong password has been provided, or the password has been changed. Look at the advanced properties of the Application Pool in IIS for which account it uses.
Also the Event Log might contain more information as to why the Application Pool is stopping immediately on the first request.
Ok, I have another solution for one specific case: if you use WINDOWS 10, and you updated it recently (with Anniversary Update package) you need to follow the steps below:
Check your Windows Event Viewer - press Win+R and type: eventvwr, then press ENTER.
On the left side of Windows Event Viewer click on Windows Logs -> Application.
Now you need to find some ERRORS for source IIS-W3SVC-WP in middle window.
Probably you will see message like:
The Module DLL >>path-to-DLL<< failed to load. The data is the error.
You have to go to Control Panel -> Program and Features and depending on which dll cannot be load you need to repair another module:
for rewrite.dll - find IIS URL Rewrite Module 2 and click Change->Repair
for aspnetcore.dll - find Microsoft .NET Core 1.0.0 - VS 2015 Tooling ... and click Change->Repair.
Restart your computer.
For my situation is that my login password changed, while the application pool still uses the old one. So just click the "Advanced Settings" of your application pool and reset your "Identity".
I was facing the same problem, and debugged it using the event logs. First it said that : "The description for Event ID 5059 from source Microsoft-Windows-WAS cannot be found".
I then turned on WAS using turn windows features on/off. Then i saw this in eventvwr
"Microsoft-Windows-DistributedCOM cannot be found".
Finally I gave up and deleted the App Pool (that used to stop on accessing the website) and created it again, as it is. This resolved the problem.
Most of Time, it was occured due to AppPool Setting.
Check the following to resolve this
Check Apppool service is running.
Check Identity of AppPool.
Enter the new password if it has changed for that identity.
The following Images show these setting in IIS
For anyone coming here with Windows 10 and after updating them to Anniversary update, please check this link, it helped me:
https://orcharddojo.net/blog/troubleshooting-iis-apppool-crashes-status-503-after-windows-10-anniversary-update
In case link goes down:
If your Event log shows that aspnetcore.dll, rewrite.dll (most often, but could be others as well) failed to load, you have to repair the missing items.
Here are two specific issues we've experienced so far and how to fix them, but you may bump into completely different ones:
"C:\WINDOWS\system32\inetsrv\rewrite.dll" (reference)
Go to "Programs and Features" (Win+X, F) and repair "IIS URL Rewrite Module 2".
"C:\WINDOWS\system32\inetsrv\aspnetcore.dll" (reference)
Go to "Programs and Features" (Win+X, F) and repair "Microsoft .NET Core 1.0.0 - VS 2015 Tooling ...".
If you have McAfee HIPS and if you see the following error in event viewer application log:
The Module DLL C:\Windows\System32\inetsrv\HipIISEngineStub.dll failed to load.
The data is the error.
Then the following resolved the issue in my case:
https://kc.mcafee.com/corporate/index?page=content&id=KB72677&actp=LIST
Quote from the page:
Click Start, Run, type explorer and click OK.
Navigate to: %windir%\system32\inetsrv\config
Open the file applicationHost.config as Administrator for editing in Notepad.
Edit the <globalModules> section and remove the following line:
<add name="MfeEngine" image="%windir%\System32\inetsrv\HipIISEngineStub.dll" />
Edit the <modules> section and remove the following line:
<add name="MfeEngine" />
After you have finished editing the applicationHost.config file, save the file, then restart the IIS server using iisreset or by restarting the system.
In my case I checked event logs and found error was
Cannot read configuration file ' trying to read configuration data from file '\\?\', line number '0'. The data field contains the error code.
The error code was 2307.
I deleted all files in C:\inetpub\temp\appPools and restarted the iis. It fixed the issue.
I had a similar issue. I solved it by adding my user to the "Log on as a batch job" policy under "Local Security Policy" > "Local Policies" > "User Rights Assignment".
When I first time add the service and created the app pool for it.
I did "iisreset" from command prompt, and it worked.
I was experiencing this error and in my case the cause was that some time ago I modified the user password, and the 503 error didn't appears till I restarted the application pool.
So I fixed it setting the new password on Applications Pools / Advanced Settings / Identity / [...] / Set... / Password / Confirm Password
If you can run the website in Visual Studio debugger, then might be able to see where in your code the application pool is crashing. In my case, it was a function being called recursively an unlimited number of times, and that caused a stack overflow. Note: the Windows event log and the IIS logs were not helpful to diagnose the problem.
I had the same issue with iis 8.5. After searching the eventViewer under windows Logs-->applications, I realized that I'm having a permission error for the machine.config file of the .net framework located at "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config".
Giving it a permission for IIS_IUSRS solved my problem (right click the file-->properties-->security-->edit-->add-->IIS_IUSRS)
Just to add to these Anniversary Update issues (thanks Microsoft) if the file you are missing is cgi.dll, ie your Event Viewer has
The Module DLL C:\WINDOWS\System32\inetsrv\cgi.dll failed to load. The data is the error.
Then to fix this:
Go to IIS Manager
Select the very top row in the Connections panel (typically your PC name)
At the very bottom of the right panel, under Management, you should have Web Platform Installer
Once that loads, select Products
In the search type in cgi then hit <Enter>
Select IIS: CGI then click Add on the right and finally Install on the bottom
After installing it should force you to restart your PC and you should be fixed.
To Fix the problem, Follow the steps as I faced the same issue and below solution worked for me
1- Give full Rights or at least read access rights of Folder "C:\inetpub\temp" to IIS_IUSRS
2- also check same rights given to User IIS_IUSRS of folder "C:\inetpub\wwwroot".
hope this solution works!
I had a similar issue, all my app pools were stopping whenever a web request was made to them. Although I was getting the following error in the Event Viewer:
The worker process for application pool 'appPoolName' encountered an
error 'Configuration file is not well-formed XML ' trying to read
configuration data from file
'\?\C:\inetpub\temp\apppools\appPoolName\appPoolName.config', line
number '3'. The data field contains the error code.
Which told me that there were errors in the application.config at:
C:\Windows\System32\inetsrv\config\applicationHost.config
In my scenario, I edited the web.config on deploy with an element IIS clearly dislikes, the applicationHost.config scraped the web.config and inserted this bad element and wouldn't resolve until I manually removed it
In addition to the steps outlined at this link from Orhan's answer, you may need to additionally remove the native module by going to IIS Manager > Server Root > Modules > Configure Native Modules. Select MfeEngine and then select Remove.
Changing "Managed Pipeline Mode" from "Classic" to "Integrated" worked for me.
It can be changed at Application Pools -> Basic Settings
One possible reason this might happen is that you don't have enough disk space in your server machine. You can find more information in event viewer.
if such thing happen, just stop the IIS, clean some free disk space and restart the IIS and then start the App Poll.
Such 503 errors were encountered on our side on Windows Server 2019 while setting up a fresh new Classic ASP website.
In fact, in the App Pool, setting ".NET CLR Version" to "No Managed code" caused the App Pool to stops 2 seconds after being started, thus generating WAS 5002 and 5021 errors in the Windows Event Log.
The solution was to put "v4.0", even if no .NET is used.
I'm late to the party, but the solution that worked for me isn't listed.
The solution for me was simply to delete the web site and application pool within IIS, and re-create them.
This is because originally I had create the site/folder first, then installed the dotnet core runtime. For some reason this failed to allow the site to start up.
Once re-created, the site came to life with none of the other suggestions being required.
In my case, the web sites displayed "503 Service unavailable" and the application event log showed "...\aspnetcorev2.dll failed to load. The data is the error." This only happened for IIS sites where where the IIS setting "Enable 32-Bit Applications" was True. The system was stopping the app pools for these sites, which is what generated the "503 Service unavailable" message when trying to retrieve the site.
It turns out the path specified in this application event log didn't even exist. Trying to repair the two "Microsoft.NET Core SDK 2.1.50x" versions installed on the system didn't resolve the issue, nor did installing the latest and only aspnetcorev2.dll that Microsoft seems to have available, nor did uninstalling these SDKs.
NOTE: Microsoft doesn't even seem to have the installers available anymore for the original v2 ASP.NET Core versions that had been installed on my system.
What worked:
Since I don't have any ASP.NET Core sites on this system, the solution that worked for me was to uninstall all the related DLLs from my system and to remove them from the IIS applicationhost.config file by commenting them out (see aspnetcore.dll failed to load and applicationhost.config file path in IIS 7, 7.5, 8, 8.5 and IIS 10?). If you do use a later version of ASP.NET Core, I'd think you could just as well update the references in applicationhost.config [I haven't tried that].
In my case this application pool automatically stopped due to error log folder I created in local which is not exist in server. Check the web.config file whether any key path you added which is exist in server or not.
Will this answer Help you?
If you are receiving the following message in the EventViewer
The Module DLL aspnetcorev2.dll failed to load. The data is the error.
Then yes this will solve your problem
To check your event Viewer
press Win+R and type: eventvwr, then press ENTER.
On the left side of Windows Event Viewer click on Windows Logs -> Application.
Now you need to find some ERRORS for source IIS-W3SVC-WP in the middle window.
if you receiving the previous message error then solution is :
Install Microsoft Visual C++ 2015 Redistributable 86x AND 64X (both of them)
Source
In my case error message displaed in Windows Event Viewer -> Windows Logs -> Application was "The Module DLL C:\Windows\system32\inetsrv\rewrite.dll failed to load. The data is the error."
Uninstalling rewrite module via installer solved the problem. I wasn't using any rewrite rules so I uninstalled rewrite module. Reinstalling the module may help the problem as well.
I just had this issue on some legacy servers running Windows 2008 R2. 32bit applications would crash the app pool and return a 503 without hitting the app code. The problem seems to be related to .net core module erroneously trying to load the 64bit version of the module even though the 32bit application in question was not a .net core app.
It seems that IIS still loads the module when figuring out which module to load to service the request and trying to load a 64bit version into a 32bit process is no bueno.
In the end, I had to uninstall all versions of .net core from the server and reinstall the latest (at this time 3.1.15- we're not using 5 yet). After that my 32bit apps and .net core apps could coexist on the same server.
This is the blog post that helped me resolve this after days of banging my head on it. Hopefully it helps someone out.
Blog post with the solution
Give full Rights rights to Folder "C:\inetpub"
Work for me!
Check the log written to [event viewer\Windows Logs\System] node.
Source is 'WAS'.
Before everyone reads this, I just want to say that i know that there are related threads out there, but I have either tried them or do not understand. With that being said here goes nothing...
I am trying to get a MVC Web App running in my IIS. Unfortunately, I am absolutely stuck on this error:
HTTP Error 500.19 - Internal Server Error
The Request page cannot be accessed becasue the related configuration data for
the page is invalid.
Module: IIS Web Core
Notification: BeginRequest
Handler: Not yet determined
Error Code: 0x80070005
Config Error: Cannot read configuration file due to insufficient permissions
Config File: \foo\web.config
Request URL: http://localhost/WEBAPP
Logon Method: Not yet determined
Logon User: Not yet determined
Config Source
-1:
0:
I am not quite sure what else to do. I have also tried giving read permission to the web.config file and that did not seem to work.
If anyone has any information or would be able to help me work through this it would be much appreciated. Thanks!
In my case I needed to install the IIS URL rewrite module 2.0 because it is being used in the web.config and this was the first time running site on new machine.
On this MSDN blog: Troubleshooting HTTP 500.19 Errors in IIS 7 in scenario 8 for error code 0x80070005 (E_ACCESSDENIED - General access denied error) it says:
Grant Read permission to the IIS_IUSRS group ...
.... the worker process identity (and/or the IIS_IUSRS group) needs at least Read access to the directory so that it can check for a web.config file in that directory.
Please follow these step
Go to Control Panel
Go to Programs and Features
Turn Window Feature on or off
Go to Internet Information Service node
Follow World wide web Services
Then Please Check Application Development Feature
Then Please check all Node Specially Asp or Application Framework Like Asp.net 3.5 or ASP.NET 4.5 whatever you have
I fixed this by restarting VS.
I had opened a config file in another instance of VS and apparently sth went nuts...
Goto Windows Features on or Off . Enable All Features under Application Development Features and Refresh the IIS. Its Working
I was trying to run a .net core 3.1 site from IIS 10 on windows 10 pro box, and got this error. Did the following to resolve it.
First turn on the following iis feature on.
Then follow the link below.
https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-3.1#install-the-net-core-hosting-bundle
Install the .net core hosting bundle.
The direct link is
https://dotnet.microsoft.com/download/dotnet-core/thank-you/runtime-aspnetcore-3.1.2-windows-hosting-bundle-installer
I have installed the .net core sdk and run time as well. But this did not resolve the issue.
What made the difference is the .net core hosting bundle.
I had a sub folder named web.config renaming this folder resolved the issue
For completeness, the answer to Asp.Net Core tag in web.config causes failure may also be the solution to the problem here. If the .NET Core Windows Server Hosting bundle is not installed then IIS cannot recognize the aspNetCore section in web.config. https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-3.1#install-the-net-core-hosting-bundle claims to be a direct download to the current version.
I tried all solution above. My issue is resolved after reinstalling hosting bundle.
I installed hosting bundle before in IIS Manager installation.
I think this is caused error. Don't know why, but, the reinstallation works.
My issue is that I accidentally installed another site as the default site instead of the IIS default (by opening another project.) I had to remove the default site and repoint it to the default location C:\inetpub\wwwroot using my domain login as the user to bypass with then just reopened my project that I was trying to run (the one showing this error) and it was all honky dorry
I was accessing the project from inside a Virtual Machine - sharing the project folder from the host OS (Windows 10). After trying many of the solutions, and even ensuring the permissions for the IIS_IUSRS are given, still I could solve this.
Eventually, I copied this folder from the host, onto a path on the guest OS, and now I can properly run that same ASP.NET project without ado. But, I did also go ahead and give the IIS_IUSRS group full control over this new dir as well... maybe that's not really necessary in this case? I'm lazy to test that ATM.
Delete .vs/Config folder => work for me
In my case I had .Net core SDK 3.1.403 was installed. So I installed the corresponding .Net Core Windows Server Hosting which is .NET core 3.1.9 - Windows Server Hosting.
I had this problem to run restful service on IIS in Windows 10 and Windows Server 2019, finally after a lot of researches I solved the problem. After performing the following steps, the problem will most likely be solved.
Go to the "Windows Features" and active full features IIS ("Internet Information Services" or "Web Server") and active .Net Features
Locate the source at "C:\inetpub\wwwroot"
Open IIS
Click "Edit Permissions" on your web after go to the security tab and give full
access to the IIS_IUSRS
Go to the "Application Pool" next right click on your app pool after click on "Advanced settings" and change "Identity" to "LocalSystem"
Go to the "Application Pool" next right click on your app pool after click on "Basic settings" and change ".NET CLR Version" to "No Managed Code"
If you want to set the service to a specific port, first set it to port 80 and then edit it and set your port
Well now if the problem is still not solved then install the following software on the system :
URL Rewrite 2
WebPlatform
DotNetCore.2.0.8 Windows-Hosting
Dotnet-hosting 5
Dotnet-runtime 5
MicrosoftServiceFabricSDK 5
NET.Framework 4.8
and finally restart the system.
If Folder getting from other, and host file is already generated on ProjectName\.vs\config folder, then it conflicts with a new one and gets this error.
So delete host file from ProjectName\.vs\config and restart project once again. It was worked for me
In my case, Server had lower version framework than your application. installed latest version framework and it fixed this issue.
In the Edit Application Pool window, set the .NET CLR version to No Managed Code
I had this error with Visual Studion 2019, my project was NopCommerce 4.30 which is an ASP.Net Core 3.1 project. I added page "gouden-munten-buitenland" to be the starting page and I only got the error when going to that page. Turned out that Visual Studio generated an invalid applicationHost.config :
<applicationPools>
....
<add name="gouden-munten-buitenland AppPool" autoStart="true" />
<add name="gouden-munten-buitenland AppPool 2" autoStart="true" /> <!-- WRONG -->
<add name="Nop.Web AppPool" managedRuntimeVersion="" />
<applicationPoolDefaults managedRuntimeVersion="v4.0">
<processModel loadUserProfile="true" setProfileEnvironment="false" />
</applicationPoolDefaults>
</applicationPools>
and
<sites>
....
<site name="Nop.Web" id="2">
...
<application path="/gouden-munten-buitenland/gouden-munten-buitenland" applicationPool="gouden-munten-buitenland AppPool">
<virtualDirectory path="/" physicalPath="C:\Usr\Stephan\Wrk\Kevelam\kNop.430\Presentation\Nop.Web" />
</application>
<application path="/gouden-munten-buitenland" applicationPool="gouden-munten-buitenland AppPool 2">
<virtualDirectory path="/" physicalPath="C:\Usr\Stephan\Wrk\Kevelam\kNop.430\Presentation\Nop.Web" />
</application> <!-- WRONG -->
....
</site>
...
</sites>
I removed the nodes identified as 'WRONG' and then it worked.
If your error is using a site in asp.net core, install the ASP.NET Core Windows hosting bundle.
Click on the link below and select your .net core version
In the following page find the link "Hosting bundle" (ctrl+f may help) and install it.
Worked a treat for me!
https://dotnet.microsoft.com/en-us/download/dotnet
One reason, for which I face this issue was a web.config file in Images folder (on abnormal location) and IIS was trying to allow the read rights according to incorrect settings in the web.config file.
Therefore make sure your build is correctly deployed without any abnormal files specially the configs one on invalid locaiton.
I am facing a problem for running my website.
I have developed the website and when i hit F5 to view the results i am presented with this error
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 for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
How can i solve this problem.
This error usually happens if you Map your application folder on Network Drive or open Solution file from UNC Path. somthing like this:
Invalid Example: \\my-server\my-project
Try to open your solution from direct path
Valid Example: C:\Project\MyProject
You can also make change to your privilege of App Pool Identity but it's not recommanded:
Web Server (IIS) > App Pool Identity > Advance Settings > Set Identity as Network Service
the one shot solution worked for me was to set the App Pool Identity(Advance Settings) to Network Service
Try to set "Load User Profile" value of your application pool to "True".
It worked for me.
For what its worth, I found that the AjaxControlKit.dll on the deployed server was blocked. To resolve this, I copied over the dll to a new folder then copied and pasted in the bin folder. I guess .net doesn't like a dll being copied over directly to the web folder
you can run the following command to Grant FullTrust to remote share:
C:\Windows\Microsoft.NET\Framework\v2.0.50727>caspol.exe -m -ag 1 -url
"file:////\yourcomputername\yoursharename*" FullTrust -exclusive on
Hope this helps.
I tried all of the solutions posted here and a number of other places and nothing worked for me. I had my project located on a network drive which worked until I tried to use the AjaxControlToolkit 2.0 in my project. Apparently, something about permissions on the network drive would not allow the controls in the toolkit to run. I moved my project back to my local hard drive and it all started working.
I had this problem as well but have not seen this particular solution mentioned anywhere.
After checking permissions for the IIS user, the user for Impersonation, and granting Full Trust to the application, and still getting the error, I installed Procmon.exe on the server running IIS and noticed that IIS was attempting to access some Framework64 files for the offending website. I inspected the application pool advanced settings and discovered that "enable 32-bit applications" was set to false. Changing this setting to true proved to be the correct action. Life is good.
I face the same problem, then I realised that I was running the solution from a remote folder. Copy the necessary file to the local folder will solve the issue. But make sure that your folder have the full permission
While all of the other answers on this page may be the cause of anyone's problem, the most common one is due to OS security changes in Windows Server 2012 and above. Any file downloaded from the internet is flagged as suspicious by Windows and needs to be manually unblocked before using it in IIS. So if you FTP your code, email it, or transfer it through a cloud provider, it will be flagged and blocked.
The best solution is to use the web publishing facilities built in to Visual Studio or transfer through a network share if you're on a domain, each of which avoid this problem. However, if you must copy your code to another server by one of the means I described above, you should zip everything prior to transfer so you are only left with a single file to unblock. If you unzip before you unblock, then each file will be blocked and multi-selection will not give you the option to unblock.
So finally... to unblock: Right click the file and select Properties. Right there on the first page near the bottom you'll see an Unblock button along with the warning that the file was downloaded from the internet!
If the dll is compiled using this option (Do not merge. Create a separate assembly for each page and control), please make sure the dll is up to date. I faced the error due to aspx file is new one, but dll still using old one.
I found a potential solution that worked on my system and did not require changing to Network Service.
Go to Application Pool -> Advanced Settings -> Process Model -> Load User Profile: True
Source of this answer.
The best way to resolve this issue is Run the Visual Studio as "Administator". Right click on the Visual Studio icon and select "Run as Administrator".
Once you open Visual Studio with Full admin rights, you will be able access the page without any issues.
I have had this error and it seems to be a generic error. As there are several answers to this issue, I am going to add mine. Republishing the website on the remote server seems to fix it for me.