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
Related
My web application is just a simple web application made in VS 2010 MVC 4 without any code from outside. It's just default application of VS 2010. I have Deluxe Windows Hosting with Plesk. I've never changed any feature in my account. I copy all my files to "//Root Directory". Beside my files I see various folderssuch as: ", plesk, erro-docs, cgi-bin, logs" - I do not have permissions to delete them.
All my projects are "Release" configuration. I've tried all ways which I met in the Internet:
1.I copied three libraries to bin directory:
System.Web.Mvc, System.Web.Routing, System.Web.Abstractions
These dll's I copied from GAC(C:\WINDOWS\Microsoft.NET\assembly\GAC_MSIL). I putted such strings in web.config: < trust level="Medium"/>. I used local deployment(to directory) in VS2010 by button "Publish". No result.
2.I copied 9 libraries to bin directory:
System.Web.Abstractions.dll
System.Web.Helpers.dll
System.Web.Mvc.dll
System.Web.Optimization.dll
System.Web.Razor.dll
System.Web.Routing.dll
System.Web.WebPages.Deployment.dll
System.Web.WebPages.dll
System.Web.WebPages.Razor.dll.
These dll's I copied from GAC(C:\WINDOWS\Microsoft.NET\assembly\GAC_MSIL). I used local deployment(to directory) in VS2010 by button "Publish". I putted such strings: < trust level="Medium"/>. No result.
3.I copied three libraries to bin directory: System.Web.Mvc, System.Web.Routing, System.Web.Abstractions - these dll's I copied from GAC(C:\WINDOWS\Microsoft.NET\assembly\GAC_MSIL). I putted such strings: < trust level="Medium"/>. I used deployment via ftp option in VS2010 by button "Publish". No result.
4.I copied three libraries to bin directory:
System.Web.Abstractions.dll
System.Web.Helpers.dll
System.Web.Mvc.dll
System.Web.Optimization.dll
System.Web.Razor.dll
System.Web.Routing.dll
System.Web.WebPages.Deployment.dll
System.Web.WebPages.dll
System.Web.WebPages.Razor.dll - these dll's I copied from GAC(C:\WINDOWS\Microsoft.NET\assembly\GAC_MSIL). I putted such strings: < trust level="Medium"/>. I used deployment via ftp in VS2010 by button "Publish" No result.
5.I've tried to upload files via filezzilla. < trust level="Medium"/>. However it was an idle attempt.
6.I've tried to upload files via browsers. However it was an idle attempt.
7.I've tried to upload zip-files via browser and extract them at godaddy server. < trust level="Medium"/>. However it was an idle attempt.
All above-listed attempts result the word on the screen: "nup.com My site is launching soon."
Nothing changes.
I have a question.
What I do wrong?
I've read all articles by Phil Haack http://haacked.com/archive/2008/11/03/bin-deploy-aspnetmvc.aspx. Any help will be gratefully appreciated!:)
Ok - you have a lot of questions inside your single question. I am going to try and take these one at a time as well as some of your commentary so that we can a) understand the build/publish process of an MVC app and b) hopefully get your project running over at GoDaddy.
1.If I change in web.config , then should I recompile my project and upload again?
No, unless you change the web.config locally and you need to upload those changes. If you FTP/connect to the web.config on the actual web server, IIS will automatically restart (reload) your application so that it can apply the web.config changes. After a web.config change, you will notice the first request will take 10-20 seconds. This is IIS restarting your application. If you change the web.config locally, then yes, you should rebuild/reupload.
2.Is it correct to copy a project to root of directory?
The way you have phrased this question makes me think that yes, you are doing it wrong. When you create a project in Visual Studio, you get a solution folder on your actual hard drive. If you are compiling that project, then copying the entire solution folder to your web server, then yes, this is not the correct way to do it. What you want to do is create a Publishing Profile. You can either deploy your application via Web Deploy (unsure if GoDaddy supports this), FTP, or File System. By going through the Visual Studio publishing process, the compiler a) compiles your application per your settings (Debug or Release), b) applies the proper Web.Config transformations and c) only outputs the files necessary to run your application. The third part is important. All of your .cs files (controllers, models, etc) get compiled into a .dll and that is what needs to be deployed, not the actual source code files. The publishing process does this for you.
I would recommend you create a folder on your dev machine somewhere, and then create a publishing profile that publishes your application to that folder. It is the contents of that folder that you want to FTP to your web server. To create a publishing profile, right click your MVC project and select Publish. This will bring up the wizard for you to set things up.
3.What I do wrong?
Kind of hard to say at this point. It could be that you are not compiling your application correctly. FTP sounds bonked, but that is not an MVC/Visual Studio issue. For FTP issues with Plesk on GoDaddy (and other items), check this help link here.
4.how can I see the errors? Should I write a message or what should I do to know more about errors?
You should be able to control this in your web.config. Open your web.config file up and check for a couple of lines. You want to turn off custom errors and set the compilation to debug mode. This does two things. One, the error you get back from the server will be way more detailed and being in debug mode allows IIS/.NET to actually show you the line of code that is causing the problem.
<system.web>
<compilation debug="true" targetFramework="4.5" />
<customErrors mode="Off"></customErrors>
</system.web>
Be aware that if you do have a web.config transformation, this could actually turn these setting off. Ensure that your publishing profile is set to deploy the Debug configuration while you test deploying your site. Once you are happy with your results, set it back to Release configuration so that your site runs faster as well as does not display code lines to potentially bad people if an error does occur.
5.I copied 9 libraries to bin directory...
Ok, this could also be a problem. You do not need to copy anything to your bin directory. If you want to include referenced assemblies in your published project, all you need to do is open the References folder under your project. From there, right click any assembly that you want to include in your project when you publish and select Properties. Inside of the properties pane, you will see the option to Copy Local. Set this to true. This tells the compiler to copy that assembly to the output folder during the publishing process (see, that publishing thing does lots of good stuff for you!) I would do this for all assemblies in your project that are MVC related. You can experiment with this (like one at a time) until you find the right combination of assemblies that you need to include in your project to make it run on the GoDaddy server. I have not used GoDaddy hosting in quite a while, so I do not know what their current capabilities are.
Last thoughts, I think MVC 4 is .NET 4 or higher. Ensure that GoDaddy supports .NET 4 or higher or else you really won't be able to host this on that server (even using bin deploy) and will need to find additional hosting. Azure has some really great deals right now and Gearhost is very reliable but a little pricey (though they are completely simple to use).
EDIT
Just a little more info on GoDaddy - ensure that you set your site up correctly before you try any of this. You need to have Windows hosting (most likely) and it should be setup to use the Integrated App pool (else, it would appear you never uploaded anything since there is no 'default document'). At this point, I wonder if your hosting account was provisioned correctly for what you want to do. http://support.godaddy.com/help/article/6639/do-your-hosting-accounts-support-mvc3-applications (Yes, I know it says MVC 3, but the setup applies equally to MVC 4)
Have you tried bin deploying MVC4?
http://haacked.com/archive/2011/05/25/bin-deploying-asp-net-mvc-3.aspx/
or
http://forums.asp.net/t/1884928.aspx
To answer your question:
Changes to web.config should not require the project to be recompiled.
Hope this helps...
Depends what you've changed, some changes might at least require an application pool reset.
Root of what directory? It should generally be inside inetpub/YOURWEBSITEFOLDERHERE
You have assumed that GoDaddy supports MVC 4, I could only find references to them supporting MVC 3 Support
There are rumours that if you deploy the bin and mvc dll there is a way around this but I couldn't find any details.
Have a read of the MVC 3 deploy instructions
EDIT: In answer to comment below:
Editing could have a knock on effect and so i would advise towards a recompile, e.g. change to medium trust might have an affect if DLLs don't work in partial trust mode, and recompilation might well highlight these issues.
Sounds ok, test by putting a html file up with some text and try and get to it in your browser.
I've seen people talking about it, mostly saying it's not supported, try the MVC deploy instructions above to bin deploy MVC 4; it works with 3, it might work with 4.
I had the same problem with a MVC4 I had running on hosting on Godaddy using Plesk. Suddenly, without any changes, site began to display "Site Launching Soon" Page. At first I thought it was hacked. After calling godaddy support, the agent told me that the site must need at least one html file as a start point (index.html, index.aspx, default.aspx - source: http://support.godaddy.com/help/article/60/what-file-displays-when-someone-browses-to-my-domain-name?locale=en&ci=46061), which seemed odd because it was working fine all the time.
Then, after some trial - error stuff, I could solve my problem by going to the Plesk hosting management, and navigate to:
Websites & Domains > [domain name] > Web Server Settings for domain. And there, change the Default Document setting to "Default".
We never touched that setting, not sure really why it suddenly changed.
Hope that helps!
Hope this helps . . .
Global.asax should be your default index . . . in godaddy server settings.
I had a similar problem and was able to solve it.
I have two other mvc application sites hosted on godaddy, but not with their new plesk hosting.
After calling tech support and not having any luck there I did some reading on their hosting.
Their plesk hosting must have an index.
So, a few hours later it dawned on me to point their start point to my Global.asax in their server settings.
And, viola! my site was up and running.
I've done all actions to deploy correctly but I copied all files to a wrong folder. The problem was that I just copied all my files to a wrong directory. I called to godaddy support and they said that I copied my files to wrong directory.
When I copied all files to "httpdocs" directory then my mvc 4 application start working!:).
Thank you a lot, guys. Good luck.
I was having the same issue until I set customErrors to off (first line). then I started seeing security policy issues which was remedied (second line).
(I'm using Godaddy)
I'm following Microsoft's tutorial on the topic here but it's not working and several items are unclear to me.
http://msdn.microsoft.com/en-us/library/ms733766.aspx
In step 2 it says, "ensure that ASP.NET has access to the contents of the folder". How can i do this?
Is it correct that the .cs code not be compiled? I've never ran .cs as a script of any kind.
Here is my error:
HTTP Error 404.17 - Not Found
The requested content appears to be script and will not be served by the static file handler.
Thanks.
Could you please ensure that your apppool in which your site is running in "Integrated" mode rather than Classic.
If the problem is not resolved after doing this, try to register your IIS with .netv4.0
For doing that
Go to Command Prompt
Go to the location C:\Windows\Microsoft.NET\Framework\v4.0.30319
Register the IIS using aspnet_regiis -i command
Open IISManager and go to handler mappings and right click on the static file and select "Revert to Parent"
You can Host a WCF App/Service in IIS as you host simple website. It seems to me that you are trying to access/browse .cs file. If so, then it is not possible as it is code file. You should browse only your service file i.e. .svc file.
You can refer http://adarshdchaurasia.wordpress.com/2013/09/26/create-restful-wcf-service-api-using-get-post-step-by-step-guide/ to create a WCF service.
Please ensure that:
You have .Net framework 4.0 installed and enabled on your machine. If
not, install or try to re-install. Sometimes re-installation fix the
unknown settings problem we accidentally create.
First try to host a simple demo web site to check if the problem is
with your WCF application or with hosting process your are
following.
In step 2 it says, "ensure that ASP.NET has access to the contents of
the folder". How can i do this?
I think it mean make sure your folder are accessible by the IIS_IUSRS
Check the publish folder properties -> Security tab -> group or user name.
Make sure the app is using application pool with correct .net framework version.
normally I will just set .net framework v4.0.30319
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.
Recently I met the following exception at C# solution:
Error 2 Could not load file or assembly 'Newtonsoft.Json,
Version=3.5.0.0, Culture=neutral, PublicKeyToken=b9a188c8922137c6' or
one of its dependencies. The parameter is incorrect. (Exception from
HRESULT: 0x80070057 (E_INVALIDARG))
This does not depend either on my code or on the name of assembly (like Newtonsoft.Json in this case).
When I delete this dll from the solution the compiler tells about another in the same exception. So I suppose something shoud be turned off/on at my PC :)
Looks like a corrupted assembly being referenced.
Clear both:
the \bin folder of your project
the temp folder (should be C:\Users\your_username\AppData\Local\Temp\Temporary ASP.NET Files in windows 7)
and see if the error still happens
Depending on if your are running X64 you might need to clean up a couple more spots. Just cleaning up my user directory was not enough.
%TEMP%\Temporary ASP.NET Files
C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files
This list will grow as if you have other versions of the framework installed.
I had to clear
C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files
Only then did the issue get resolved.
To know what to clear for sure - add the following registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Fusion\EnableLog (DWord set to 1).
Then you will see output like below. This tells you where asp.net is attempting to load your DLLs. Clear this directory.
LOG: This bind starts in default load context.
LOG: Using application configuration file: c:\app\AtlasAdvisor\web\web.config
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL **file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/3c8629f7/dfa387b6/Avanade.ViddlerNet.DLL.**
LOG: Attempting download of new URL **file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/3c8629f7/dfa387b6/Avanade.ViddlerNet/Avanade.ViddlerNet.DLL**.
Clear out the temporary framework files for your project in:-
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\
You can also clear the packages directory and allow NuGet to re-download missing packages
it solved the issue for me
Delete all files from these folders .
C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files
C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET
Files
Getting fresh set of binaries from Source control helped.
Thanks
Just clear this folder: (only windows x64)
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files
Thanks Alex your second point helped me fix this.
It appears that unless you run visual studio as an administrator in Windows 7 it stores your temp files locally rather than C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files.
See following blog post: http://www.dotnetscraps.com/dotnetscraps/post/Location-of-Temporary-ASPNET-files-in-Vista-or-Windows-7.aspx
I had the same issue here - above solutions didn't work. Problem was with ActionMailer. I ran the following uninstall and install nuget commands
uninstall-package ActionMailer
install-package ActionMailer
Resolved my problems, hopefully will help someone else.
This can happen while referencing COM wrapper dlls. Within your Visual Studio Project, under References, select the COM wrapper dlls being referenced and ensure they have the the following property values: "Embed Interop Types": False and "Specific Version": False.
I just delete my application temp data from this path
C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files
Problem resolve
I see lot of techies have posted about clearing temporary directories of ASP .Net run-time pertaining to each and every .Net framework hosted on your machine as in this answer. But I believe we should know the clear-cut logistics as to why we need to blindly clear all of temporary working directories of all .Net frameworks. According to me, it should not be the case.
My advice would be that you should try a pin pointed directory clearing approach to resolve this issue. How would you know which directory to clear?
Go to IIS and right click on your website node in left navigation pane to open the context menu. In the context menu point to Manage Application -> Advanced Settings... to open the Advanced Settings window.
Check the Application Pool your website is assigned to. In my case it is DefaultAppPool as shown below:
Now go to Application Pools node in left navigation bar in the IIS. Now check that which .Net CLR Version is being run by your app pool. In my case it is v4.0 as shown below:
Since the CLR version being hosted by my app pool is v4.0, so I prcisely cleared only the temporary files in the folder pertaining to ASP .NET v4.0 only as below:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files
And that's it. My problem got resolved.
Lesson learnt: This is indicative of the fact that all the temporary files being used by your website aren't scattered across several directories but they are at once place being referred by your app pool. So you need to clear that specific folder only.
Clearing C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files worked for me. Thinking of automating the deletion process to avoid the issue in future.
If you are using SQL Server 2012's Data Tools, which uses the VS2010 shell as at May 1 2013, check your Configuration Manager settings. A server name change from Workflow to xCPWorkflow was enough to produce the exact same The parameter is incorrect (Exception from HRESULT: 0x80070057 (E_INVALIDARG)) message.
You can either clean, build or rebuild your application or simply delete Temporary ASP.NET Files at C:\Users\YOUR USERNAME\AppData\Local\Temp
This works like magic. In my case i had an assembly binding issue saying Could not load file bla bla bla
you can also see solution 2 as http://www.codeproject.com/Articles/663453/Understanding-Clean-Build-and-Rebuild-in-Visual-St
I had this problem when making controller in MVC. I changed version .net framework. The problem was solved
The problem relates to the .Net runtime version of a referenced class library (expaned references, select the library and check the "Runtime Version". I had a problem with Antlr3.Runtime, after upgrading my visual studio project to v4.5. I used NuGet to uninstall Microsoft ASP.NET Web Optimisation Framework (due to a chain of dependencies that prevented me from uninstalling Antlr3 directly)
I then used NuGet to reinstall the Microsoft ASP.NET Web Optimisation Framework. This reinstalled the correct runtime versions.
In my case i wanted to compile a COM visible DLL. The problem was that an older version of this DLL was located here:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE
Thus Visual Studio loaded this version instead of the newly compiled one, as it tried to register it.
Clear all files from temporary folder (C:\Users\user_name\AppData\Local\Temp\Temporary ASP.NET Files\project folder)
Sometimes you, also, need to clean this folder: C:\Windows\Temp\Temporary ASP.NET
I faced same error because application didn't find dependent frameworks in C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\ folder. I just repair my Visual studio which added required framework in above location and it working fine.
In my case, changing the IISExpress port number in my project properties, solved the problem.
If anyone else out there is using the WiX toolset, I discovered that my installer project had a reference to an old project that had recently been removed from the solution. Took me a while to realize since there are a number of projects in the solution I was attempting to build and the message did not indicate which project was failing to build (and clean, which was failing as well).
I had users of Siemens Teamcenter 10 Client for Microsoft Office getting the same error about a different DLL. None of the other answers worked. The solution was to delete the folders in
C:\Users\%username%\AppData\Local\assembly\
I Had the similar issue while opening Nuget Packet manager,
I removed all the temp files and build the project, it worked fine.
I had the same issue with "Chocolatey Server (Simple)" running on IIS and had to do the following steps
Clean the "C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files" as recommended
Uninstall the "Chocolatey Server (Simple)" application via choco
Remove the directory "C:\tools\chocolatey.server" from the chocolatey package directory. Important, because otherwise Web.config is holding old dependencies which leads to the error. A simple re-installation will not update an existing Web.config (as it was in my case).
Restart IIS and config Chocolatey Server as recommended by the authors. The chocolatey server page should now be visible without any errors.