ASP .NET MVC 4 This program is blocked by group policy - asp.net

Sorry for posting this in here. I googled solutions but nothing worked.
I have a Asp .net MVC 4 project which is a scraping project that uses phantomjs.
Now I deployed it in shared windows plesk hosting. But the error says "This program is blocked by group policy". I suspected phantomjs is being blocked.
I attached a screenshot below.

From the stack trace, it appears that the error occurs when Selenium attempts to spawn a new process. Most likely spawning a process from a web app is not allowed by the hosting provider.

It seems that Selenium cant attempts to spawn a new process in hosting provider or you should connect as administrator :
if you are hosting in a specific domain click application pool->click on your domain(example.net)->advance setting ->Check you identity in process Model:you should login as administrator User..
if your website on default application pool you should click on Default Web Site->basic setting ->connect as : administrator User

This can be done by two ways.
1 - Add following code in WebConfig
<system.web>
<trust level="Full" />
</system.web>
2- Go to Tools > NuGet Package Manager > Manage NuGet Packages for Solution in Visual Studio
Find “DotNetCompilerPlatform” and uninstall it

This answer I found on GoDaddy's community forums, but I thought it would be helpful to share in case it solves the issues for other hosting providers. If the post still exists, view it here => https://www.godaddy.com/community/Managing-Web-Hosting/Problem-with-Windows-Web-Hosting-quot-this-program-is-blocked/m-p/14513#M321
From User "mojosound"
These things need to happen:
Web.config needs to be changed so that <trust level="Full" /> is added in the system.web section.
Web.config needs to be changed so that the compilers are removed. The system.codedom needs to be empty. <system.codedom /> <!-- No
compiling on server, GoDaddy blocks it. -->
The settings in Visual Studio for publishing the website need to be changed to enable precompiling the website. The root cause of the
issue is that GoDaddy does not allow compiling of the website on the
server. This was the permission issue observed above. Once these
were done the site came up fine.
After making these changes to the Web.Config and Publish settings, everything started working in the hosting environment.

Related

The application attempted to perform an operation not allowed by the security policy

I have developed an Asp.net website in Visual Studio 2008 and it worked fine while using Vista OS but my workstation got upgraded to Windows 7 and I now get following error:
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 for the
permission of type 'System.Web.AspNetHostingPermission, System,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
failed.
I get this error while running on my local machine from within Visual studio... I have already googled the error but nothing i found helps so far. I don't get the error when deployed on server, just on my local.
The website references .dll projects that I have created in the same solution. The error seems to occur when I try to instaniate an object contained within any one of these .dll projects.
This setting in Web.config did not help:
<trust level="Full" originUrl="" />
neither did this:
<securityPolicy>
<trustLevel name="Full" policyFile="internal" />
</securityPolicy>
This worked for me. in web.config add
<system.web>
<trust level="Full" />
</system.web>
This is an old question, but I experienced this exact issue recently and as the problem existed on the local machine and not on a remote one like most of the rest of the information pulled up with this particular error, none of those solutions helped so I'm going to put my solution here.
My issue was that I was using a networked workstation and trying to run a solution that was stored on a network drive. For some reason, my local machine did not trust that particular drive and it would not accept any of the attempts to raise the trust level of the application.
Once I realized the issue was the drive itself, I simply moved the entire solution over to another one and it solved the problem for me. I imagine that a talk with the Network Admin about their permissions could likely helped to correct the error also, but just switching the solution to a local drive fixed the issue that I was having and might work for others.
RESOLUTION
To resolve this behavior, grant the FullTrust right to the remote share:
On the Web server, open Administrative Tools, and then double-click Microsoft .NET Framework Configuration.
Expand Runtime Security Policy, expand Machine, and then expand Code Groups.
Right-click All_Code, and then click New.
Select Create a new code group. Give your code group a relevant name, such as the name of the applications share. Click Next.
In the Choose the condition type for this code group list, select URL.
In the URL box, type the path of the share in the following format:
file:////\\computername\sharename\*
Note Replace computername with the name of the computer that is hosting the remote share. Replace sharename with the name of the share.
Click Next. On the next page, select Use an existing permission set, and then select FullTrust.
Click Next, and then click Finish.
Restart Microsoft Internet Information Services (IIS) to restart the ASP.NET worker process.
If Microsoft .NET Framework Configuration is not displayed under Administrative Tools, you can install the .NET Framework SDK to add Microsoft .NET Framework Configuration. Alternatively, you can run the following command to make the change:
Drive:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\caspol.exe -m -ag 1 -url "file:////\\computername\sharename\*" FullTrust -exclusive on
For more details: https://support.microsoft.com/en-us/kb/320268
RESOLUTION
(1) Create an application pool for the appropriate domain using Internet Information Services (IIS). Login to the remote desktop and open IIS Manager. Expand the tree Application Pools. Right click and select New | Application Pool and give the required particulars.
(2) The next step is to place the domain under the newly created application pool. In order to perform this action, expand the tree labeled Web Sites and then Default Web Site under it. Select your domain name, right click on it and choose Properties menu item. Select the drop down box labeled Application pool and choose the newly created application pool name.
Note: You can automatically perform the above mentioned steps using certain popular hosting control panels if you have installed them on the server.
(3) Add the following lines of code to machine.config file. This file can be located under the folder - Root Drive Name:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\CONFIG
<location path="yourdomain.com" allowOverride="true">
<system.web>
<trust level="Full" originUrl=""/>
</system.web>
</location>
(A) You should require administrative rights to the server and access to remote desktop to resolve the above issue. You should contact your hosting service provider if you don’t have access to the server.
(B) Replace yourdomain.com with the appropriate domain name in which the problem is occurring.
Warning: Incorrect modification of machine.config file will cause problems to the ASP.NET service on the server.
Try this
Go to the properties of precompiled dll’s, check to see if it has following security message (at the bottom of the window): "This file came from another computer and might be blocked to help protect this computer." If present, click "Unblock", "Apply" and "OK".
OR
Run the below caspol command to resolve the issue Drive:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\caspol.exe -m -ag 1 -url file:////c:\mysitecontent\* FullTrust -exclusive on
Note: Please substitute c:\mysitecontent\* with actual path where ASP.net pre-compiled DLLs are located.
And restart the system.
If it helped you vote it up please.
I was getting the same error...so I solved with two steps. First, adding code in web.config file.
and second, changing the IIS Manger.
Select the server in IIS. Click/Open Feature Delegation under management. Than, change .NET Trust Level to Read/Write (from right hand Action panel)
Thanks

my godaddy hosted orchard website is thrownig The page cannot be displayed because an internal server error has occurred

My godaddy hosted orchard website is throwing:
"The page cannot be displayed because an internal server error has occurred"
Any one faced this issue?
I was getting the same error message, but I am not running Orchard. I had moved a ASP.NET 4.5 site from a hosted Rackspace server to GoDaddy. I found that the problem was related to a tag in the web.config; similar to this:
<system.webServer>
<staticContent>
<mimeMap fileExtension=".woff" mimeType="application/x-woff" />
</staticContent>
</system.webServer>
Once I removed the tag I stopped getting the error. Since this app was built by someone else, not sure if I will need to figure out how to re-insert the tag or not.
Hope this might help someone else who stumbles upon this question via Google search.
Short answer, check the .NET version you're loading Orchard on. If your using v1.6 then you need .NET 4.0.
This happened to me, when I updated a .Net 2.0 website to Orchard. The hosting company the Client was using is Shared hosting and all my testing environments ran the site fine. It wasn't until I asked the Client to ask there hosting company what version they were using, that the penny dropped. Also check your permissions with the App_Data folder if your using SqlCE.
This may have cause by the permission settings of App_Data folder. You may need to give write access to this folder.

IIS 7.5 and Razor Site: 500 errors for CSS and JS

For some reason, when I deploy my Razor MVC web site to my Windows 2008 R2 server, I'm getting 500 internal server errors for all CSS and JS. I'm not sure why, because I've done the following:
Enabled static content in IIS
Enabled anonymous access, with the default ID being the application pool identity and given that identity read/write permission to the folders
Ensured my static content handler was setup correctly
What other problems could it be? How can I even debug this to see what the actual error is? Even though I have an Application_Error handler, nothing is getting logged. And IIS logs doesn't give me the error info?
Thanks.
Mime-Types were my trouble
I had the same problem. My css and js was not delivered. Server says internal error.
I found out that i added the mimetype for mp4 in the global settings of the iis and also added the mime type in one of my websites as well.
That was a problem. This mime-type can only exist in the website or global, not both.
I deleted tehe global mimetype and everything worked like it should be.
Hope to help some guys of you.
Just found, that I've added to web.config *.woff MIME for IIS 7.5, so when deploying on IIS8, it's causes static files error. After removing that from web.config everything is fine.
I got 500 errors because I added this below to my web.config. After I removed it, I got passed the error.
<staticContent>
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
</staticContent>
To rule out one basic permissions situation, try this:
Select your web site and go into Basic Settings.
Take note of which application pool your site is running under.
Exit out of there and select the Application Pools node.
Find the application pool for your site, and take note of which identity (account) that application pool is running under.
If the account is a specific user identity -- in other words, if it's not a built-in account (such as ApplicationPoolIdentity, Network Service, Local System, etc) then:
Launch your Local Users and Groups.
Find and open the local IIS_IUSRS group.
If the account in question is not a member of the group, add it.
Reinstalling IIS fixed the problem.
If you are on your local server and taking this error, please check if you have any missing packages. Catch errors in global.asax and if neccessary reload all packages with;
Update-Package -reinstall
in Package manager console.
Hope it helps.

Cannot log on locally IIS [duplicate]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
What causes this error, how can I fix it?
Detailed Error Information
Module IIS Web Core
Notification BeginRequest
Handler Not yet determined
Error Code 0x8007052e
Config Error Can not log on locally to C:\inetpub\wwwroot as user administrator with virtual directory password
Config File Unavailable (Config Isolation)
Requested URL http://192.168.0.3:80/
Physical Path C:\inetpub\wwwroot
Logon Method Not yet determined
Logon User Not yet determined
Config Source
<application path="/" applicationPool="PS-Extranet">
<virtualDirectory path="/" physicalPath="%SystemDrive%\inetpub\wwwroot" userName="administrator" password="[enc:AesProvider:PrISRz2ggJH4bV46ktObfCSh91Y/yF9pAoLmH7eCnj0=:enc]" />
</application>
I had the same issue, but reason was different.
In my web.config there was a URL rewrite module rule and I haven’t installed URL rewrite module also. After I install url rewrite module this problem solved.
Looks like the user account you're using for your app pool doesn't have rights to the web site directory, so it can't read config from there. Check the app pool and see what user it is configured to run as. Check the directory and see if that user has appropriate rights to it. While you're at it, check the event log and see if IIS logged any more detailed diagnostic information there.
On Windows 10 I had to install ASP.NET 3.5 and ASP.NET 4.6 under Internet Information Services (the other boxes automatically check themselves):
Finally I get the solution for my problem. The asp.net account not appear in the IIS manager because I didn't check its check Box in IIS to do this in windows 7 follow the steps
Open control panel
Click on” program” link (not uninstall programs)
Click” turn windows features on/off” link
locate” Internet Information services IIS” in the pop up window and expand its node
Expand the” World Wide Web Service” node
Expand “Application Development Features” node
check the check box of”ASP.NET”
Then click ok button
Now you will see the Asp.net account on the IIS manager and by default you see IIS account Now you should move you asp.net website from “my document” to another place the IIS have permission to access it (to any partition on your computer) Now browse your website from IIS manager and it should work.
We got this error after having to change our domain administrator password.
After monkeying with several settings, I eventually found that in the application in below path as it was set to specifically use the domain administrator account rather than pass-through authentication (who knows why).
IIS Manager -> Basic Settings -> Connect
you need to do one step:
run->cmd
run "c:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i"
Thats it
Experienced this issue today and resolved it. Someone had set the "Path Credentials" for the "Default web site" in IIS to run as a specific user. This same user changed her password either due to the password expiring or just a routine change. Setting the "Default website" to connect as the "Application User" via the basic settings option resolved it for me
you probably change your NT password.
Open IIS -> Right click on your application -> manage application -> advanced Setting -> physical path credentials.
good luck
In my case, this error appears after changing folder's solution.
I solve the problem by goin to my project properties and recreate my virtual directory.
Right click on project > Properties > Web > Under Servers section click "Create Virtual Directory"
It will display a message saying that the virtual directory was created in another place and it will change it
For me, I needed to enable Http Activation under the .Net features in "Add/Remove Windows Features"
Got this working alright but not based on suggestions above. My case is that am getting the 500 error running iis7 on a windows 2008 server in a domain. Just added a new user in the domain and basically allow read/execute access to the virtual directory or folder. Ensure that the virtual folder>basic settings> Connect As > Path credentials is set to a user with read/xecute access. You can test settings and both authentication and authorization should work. Cheers!
Default web site need to manage as well:
1 .On Default web site -> basicSettings -> connect as, change it to the right user.
2.change the Identiy of the applicationPool that related to the defaultWebSite
g.luck
Right now i had this error and resolved it. Your url could match with created virtual directory.
You have to check virtual directories, in my example i found in applicationhost.config next row:
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/admin/roles" physicalPath="C:\..." />
</application>
I tried to open page with an url (http://localhost/admin/roles) of AdminController and Roles action and got this error.
For others out there, I got a similar error message due to trying to run a .Net 4 app in a .Net 2 app pool. Changing the .Net FX version for the app pool fixed it for me.
I was having a similar error installing php 5.3.3 with the Error Code 0x80070020 with a direction to a few lines in web.config in my www root directory (not the standard root directory).
The solution, while crude, worked perfectly. I simply deleted the web.config file and now everything works. I spent HOURS trying other solutions to no avail.
If anyone thinks this was stupid, please let me know. If anyone else has spent the same amount of time pulling out hair, try it and see (after backing up the file of course)
Regards FEQ
Was having the same error and fixing the credentials in the IIS app pool did not help. I finally resolved the error in IIS by selecting my website under Default Web Site, Advanced Settings->Physical Path Credentials->Specific User, and reentered the credentials for the app pool user, then restarted IIS and the error went away and my website came up successfully.
As I got the 500.19, I gave IIS_IUSRS full access rights for the mentioned web.config and for the folder of the project. This solved the issue.
You can give permissions by
right click on the folder / file
selecting the tab "security"
add the user IIS_IUSRS - don't forget the i in front of USRS and don't write an "e" as in USERS
If it's bigin when you try to acces to joomla administrator panel, Just a username and password problem !! You have just to update a jos_user in your joomla database.
Go to your joomla web site directory and open a configuration.php with bloc note or note pad to show what database name your joomla administrator site use.
You have to find a line who have:
public $user = 'joomlauser251'; //MySQL username
In my case joomlauser251 is my DB name.
Login to your mysql:
mysql -uyourusername -pyourpassword
Select database for your joomla:
use joomlauser251;
Change password for admin:
UPDATE jos_users SET password=MD5(‘NewPassword’) WHERE username=’admin’;
And retry to acces again.
That’s all !!!
Didn't seem to be a permission issue for me - tried giving the IIS_IUSRS account full control over everything in the web service, just to see if this was the cause. The fix turned out to be recreating the application hosting the web service (i.e. the actual '.svc') in IIS
In my case, I found a reference to an old domain account password in applicationHost.config under Virtual Directory defaults.
so easy
find the file "applicationHost.config" in Windows -> System32 ->inetsrv -> config
1. backup "applicationHost.config" to another filename
2. open file "applicationHost.config" clear data and save
3. open browser and call url internal website , finished.
If you are using a new, dedicated, user account... It is also worth checking that the password for that account has not expired, as that will also cause this 500.19 permissions issue.
For ASP.NET Core websites, this generic error will also occur if you don't have the HttpPlatformHandler module installed, see this answer for more details.
ASP.Net applications come pre-wired with a handlers section in the web.config. By default, this is set to readonly within feature delegation within IIS. Take a look in IIS Manager
1.Go to IIS Manager and click Server Name
2.Go to the section Management and click Feature Delegation.
3.Select the Handler Mappings which is supposed to set as readonly.
4.Change the value to read/write and now you can get resolved the issue
I have just one more thing to say about this. With the same HTTP Error code, you can still have several different errors, as one of them has been posted here at the original question's description.
For example: after I've edited the Web.Config file of an ASP.NET project, I had
Error Code 0x8007000d
"Only one <configSections> element allowed. It must be the first child element of the root <configuration> element "
As it says, you must NOT insert your own XML stuff before the <configSections> part of the Web.Config file. After I've inserted my snippet after the end tag of <configSections>, it worked just fine.
My website's correct path was not specified in IIS.
My solution is that,
just delete the corrupted folder.
Then re-create folder again.
It seem that if the corrupted folder had been created before IIS
setup. If you created folder again, it will work correctly.
I got this error after uninstalling Windows Server Update Services (WSUS) from the computer running IIS. Apparently uninstalling WSUS may break the IIS configuration on the server making other web application installed on the same server unavailable.
I found the solution for the problem here.
In my case, the value of the Key was incorrect in Web.config file:
<defaultDocument>
<files>
<add value="Portal.htm" />
</files>
</defaultDocument>
when I change the value to "Portal.html" it worked.
I got this error after upgrading from Visual Studio 2013 to 2015. After a bit of searching and trying various fixes I found the problem can be resolved by removing the following from web.config:
<staticContent>
<mimeMap fileExtension=".less" mimeType="text/css" />
</staticContent >
Apparently staticContent is deprecated now?
Source
Edit 1
This sort of prevented IIS from serving .json files when the program was deployed. If you do this you're supposed to re-add .json (application/json) to the mime types of your site in IIS. Here is some more info: http://www.iis.net/configreference/system.webserver/staticcontent/mimemap
Edit 2
I noticed that in my situation the above edit 1 solution only works temporarily. Once I redeploy the entry gets removed. So, I moved the mimeMap XML into Web.Release.config. Works fine now.

Could not load file or assembly 'AjaxControlToolkit' after upgrade to .net 4.0

I have a web application that I am attempting to upgrade to .net 4.0.
I took the application and opened it via Visual Studio 2010 Beta 2 and selected the upgrade path for that application. The application uses the AjaxControlToolkit. Now that the upgrade is complete when I attempt to access a page I get the error message: "Could not load file or assembly 'AjaxControlToolkit' or one of its dependencies. Access is denied."
I've tried:
Restarting my machine
Clean Solution
Removing all files in Temporary ASP.Net Files
Relaxing permsissions (added Everyone with Full Control) on the Bin directory, the Temporary ASP.Net Files directory
Removing and readding the reference to the AjaxControlToolkit DLL
The related web.config entries for the AjackControlToolkit are:
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
<controls>
<add tagPrefix="ajaxToolkit" namespace="AjaxControlToolkit" assembly="AjaxControlToolkit"/>
</controls>
</pages>
Any ideas as to what is occuring here/how I can fix this issue?
I had a similar problem but was able to resolve by granting full rights to the "Temporary ASP.NET Files" folder for my impersonation identity.
I realize there's already an accepted answer, but for anyone else coming to this page via a search on the error code....
Review the permissions of the user that you're trying to impersonate.
In my situation, I was only getting the error on my development machine, rather then on our staging or deployment servers. (For while I got around this by removing the 'identity' node from config in my dev environment and just adding the line in post-build so it wasn't a problem for anyone other than me..
In my environment we have a specific user that all our web apps impersonate when running. I had created the user account, but hadn't explicitly set its account permissions. When I added the user as an Administrator on my dev machine, this problem went away completely. (Not ideal, I know, but it "works for me", and has minimal harm since that user account is locked down on our 'real' servers anyways..)
I think the post about the Temp files in C:\Windows\Microsoft.NET\Framework64\v4.0.21006\Temporary ASP.NET Files[projectName] was on the right track.
I solved the problem by editing permissions to be sure that the ASP Impersonating user (found in the security section of IIS as the Anonymous user that the app should use when allowing anonymous access) had the proper security to the directory.
Solved the problem... Access Denied ussually points to a permissions issue.
I got this error message (although another dll file) when I reinstalled my ASP.NET application on a new Windows Server 2008 machine. I searched for a solution to this for hours, trying absolutely everything, but to no avail. Until I deactivated McAfee antivirus. When I did, everything worked like a charm.
Not 100% sure why this worked, but in the appropriate Temporary ASP.Net Files directory (located at: C:\Windows\Microsoft.NET\Framework64\v4.0.21006\Temporary ASP.NET Files[projectName]) I manually coppied the AjaxControlToolkit.dll.
I was then presented with additional DLLs that were missing, but upon manually copying them to this location also I was able to resolve these issues. Doesn't seem like the best answer, but it ended up working for me.
I tried giving my impersonated user full rights to the Temporary ASP.NET Files folder, but that didn't work. I remember in the past when I got this error that it did the trick.
I know the question poster tried this but it worked for me when I removed/added the AjaxToolKit in visual studio. I suggest trying everything he has done first. I hope this helps someone.
You can try this:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\ . Just clean up all the folders and files from inside this folder and compile ur application. Happy coding!
Odd error. Is anything in your web.config file pointing to the AjaxControlToolkit with a public key token or other assembly specifications provided? That has happened to me, where a value changed or I changed from a reference in the GAC to a local reference...
HTH.
I was facing the same issue. After a lot of research I found out that I was using impersonation in the config file. I had to change the impersonation ID to a different user that was local to the server and it resolved the issue immediately.
Inspect the DLL's properties. If it states somewhere that "this file came from another computer", click the checkbox and "apply", to lift restrictions Windows has put in place.
Remember to also open "Visual Studio" with "Run as administrator" using context-menu [right-click].

Resources