Error when deploy Web API on IIS - asp.net

I have a Web API project, and will be deployed on IIS. When I publish the project through VS2012, I always got errors like - Unable to add file 'Scripts/jquery.unobtrusive-ajax.min.js'. Access is denied. No file in the package is copied into wwwroot.
But, on the other PC it works perfect.
Can anyone suggest on this?
Thanks
Botem

I resolved this by running the VS2012 as administrator. Seems it's a permission problem.

Related

Getting an error when trying to publish .net 5 web application

I got this error when I published my web application to IIS.
Title : HTTP Error 500.19 - Internal Server Error
I viewed most questions on this and all saying that I should install a hosting bundle and I did install the latest one according to my targeted framework and still facing this.
What I tried:
1-the application works fine on IIS Express from VS.
2-I published the application from web deploy to the local IIS and I
tried
on both modes self-contained and framework-dependent.
3-installed hosting bundle.
4-changing hosts files and it works fine even on other .net frameworks
sites.
5-web config is okay, I couldn't get the wrong configs in
applicationhost.config .
after all, I still facing the error. please help, thanks
Finally I got it Works,
This what I did :
Uninstall IIS , Remove IIS Folder from Program Files and install It again
Install Hosting Bundle from here
I Checked the IIS Folder and I found aspnetCore module
Added the published version both modes worked for me (self -contained or framework-dependent)
the problem was that the installation didn't add aspnetcore modules to previous IIS Folder

You do not have permission to access the IIS configuration file - Web app error

I am trying to load existing c# web applications and getting below errors while loading any web project:
Creation of the virtual directory http://localhost:/ failed with the
error: You do not have permission to access the IIS configuration
file. Opening and creating web sites on IIS requires running Visual
Studio under an Administrator account.. You will need to manually
create this virtual directory in IIS before you can open this
project.
The following error occurred when trying to configure IIS Express for
project xxx.WebApi. You do not have permission to access the IIS
configuration file. Opening and creating web sites on IIS requires
running Visual Studio under an Administrator account.
I tried following, but in vain:
Running VS 2017 pro as an administrator.
I ensured that I have access to %systemroot%\System32\inetsrv\ and C:\Windows\System32\inetsrv\Config folders.
I have installed all IIS compatibility windows features through control panel.
Restarted IIS manager.
Created virtual directories.
Changed registry path of HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Personal from u:\ to C:\Users\MyUser\Documents.
Uninstalled IIS Express 10.0 from control panel and reinstalled it through VS2017 installer by clicking – Individual components – cloud, database server – IIS Express.
Repaired VS 2017.
Got admin access on machine.
Created new empty web project but getting same error while new console app runs without errors.
Restarted machine after every installation related change.
All the solutions tried are mentioned on stackoverflow but are not working for me. Is there something trivial that I am missing? Please guide me to crack these IIS errors.
I was able to solve this issue doing the following:
1- Go to C:\Windows\System32\inetsrv and double click on directory config and accept the warning message.
2- Go to C:\Windows\System32\inetsrv\config directory and double click on directory Export and accept the warning message.
Then you will be able to run the app in your local IIS without being an administrator. You can follow the path in the given Image.
This solved the problem for me with Visual Studio 2017, .Net Core 2.2 and IIS Express 10.
You need to ensure devenv.exe has sufficient permissions. You can find it at:
C:\Program Files OR Program Files (x86)\Microsoft Visual Studio nn.n\Common7\IDE
Right click on the exe, select Properties, Security. I gave Administrators full control as I'm running VS under admin.
My Simple solution was to right click on Visual Studio and click Run as Administrator. But a solution above tells you how to have Visual Studio always run without having to run as an administrator.
All these solutions could not work for me. The issue was, I have accidently uninstall IIS from control panel even it was install and showing me. but was removed from control panel. I reinstall IIS latest version and able to fixed the problem. This might help for others.
This link help me
VS2017 RC - The following error occurred when trying to configure IIS Express
The issue for me was caused when I modified my project to override application root URL. After a push/merge and new branch my project would not load any longer. reverted the changes and all is well again.
Open an elevated command prompt and enter the following command to substitute a drive path for U drive.
c:\windows:\system32> Subst u: C:\Users\MyUser\Documents
I had replaced ‘U:’ path in registry with ‘C:\Users\MyUser\Documents’ previously. I think that was not sufficient. Some references of u:\ might have been hindering IIS.
The total substitute command must have replaced all references and the IIS config error got resolved. Hopefully, now I’ll be able to load my web apps.
I had the same issue, but instead of the workarounds (such as first double-clicking certain directories each time or running the security risk of always having to always run my VS as administrator), was able to permanently resolve the issue by deleting the "ProjectName.csproj.user" file and that fixed it. I guess there was some incompatible setting in the user file that VS couldn't deal with.
For older versions, change the option from IIS to your solution name, before clicking on the green play like run button, to build and run the application.
We resolved this by removing the project and adding it back.
If you're used to run your Visual Studio via shortcut with 'Run as administrator' checkbox marked, double check it is indeed still selected. For some reason mine had unchecked itself resulting in inability to load an IIS project. I was 100% sure my VS had these administrative privileges as usual, which made me try all the Internet proposed solutions except for the most obvious one.
Restarting Visual Studio worked for me.

System.ComponentModel.Win32Exception: Access is denied when deploying to Plesk 12

I just deployed my ASP.NET MVC5 (.net 4.6) application to my hosting using Publish option in Visual Studio and selecting FTP mode. Now when I try to browse to the app address it gives me the System.ComponentModel.Win32Exception: Access is denied error. I'm using Plesk 12 in a shared hosting.
Please mind that it's a shared hosting and I'm using Plesk so don't come with the answer of changing IIS settings because I don't have access to that.
How do I fix it??
I had a similar problem and nothing was working for me. I fixed it by changing the .NET framework version to 4.5, instead of 4.5.2.
I wrote a short article about it which shows you how to change the framework version and includes other solutions to try that might fix the error for your. Hopefully this helps!

How to deploy a dll file(s) into IIS?

I need help on how to deploy a dll file into IIS. I searched on the internet but no luck i found nothing similar to my problem. I can able to publish and deploy an ASP.net into IIS but what I need is a single dll file and deploy to IIS.
Is it possible to deploy an dll file only into IIS? If yes, please share an information on how to do it. Thanks in advance.

Using Elmah with Cassini

Does anyone know if I can use Elmah with Visual Studio build-in web server(aka Cassini)?
I get it working easily on IIS, but using same configuration, it doesn't work with Cassini. When I requested the log page via http://localhost:62364/elmah.axd, I had "The resource cannot be found."
I can't give any insight to what's causing your issue, but I can say that it works fine for me both in Cassini running on localhost and deployed to IIS.
If you're using an x64 version of ELMAH you will run into configuration problems, as outlined here: Could not load file or assembly 'System.Data.SQLite'

Resources