This article helps you in solving the errors which are encountered while publishing ASP.NET Web API on IIS using Visual Studio
While publishing ASP.NET Web API in IIS using visual studio you
may run into some errors, this article helps to provide the solution to the
possible errors that will occur.
Lets get started to solve the errors
1. Output class library not set error:
property is not set for project 'Company.Directory.Web.csproj'. Please check to
make sure that you have specified a valid combination of Configuration and
Platform for this project. Configuration=Release Platform='AnyCPU'. You may be
seeing this message because you are trying to build a project without a
solution file, and have specified a non-default Configuration or Platform that
doesn't exist for this project."
When you try to publish Web API using visual studio for the first time one of
the reason for the above error to pop up is due the incorrect settings in
.csproj.user file of the solution
Open the .csproj.user file in the solution and
change the settings in the file
Below is the code you need to add in *.csproj.user file.
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Dev|AnyCPU'">
2. 500.19 internal server error:
The above error will pop up when you do not have
the permission to access the folder/web.config file.
- In Windows Explorer, locate the web.config file
that is associated with the Web site.
- Right-click the web.config file
- Click Properties.
- Click the Security tab, and then click Edit.
- Click Add.
- In the Enter the object names to select box, IUSR, click Check Names, and
then click OK.
- Click to select the Read check box, and then click OK.
- In the Web.config Properties dialog box, click OK.
500.21 internal server error:
One of the reasons for the error 500.21 internal
server error to pop up when is when ASP.NET is not installed completely in your
1 Run the command prompt as administrator
2.Type the line in the command prompt below any
Login for application pool access error is denied:
Create the application pool in IIS by selecting the
.NET version which your project supports.When creating the
site in the default application in IIS for Web API, select the application pool
which you have created.The above error will pop up if the application pool
which you have created has built in account selected.
(for reference go to :” Advanced
Setting->Process->Identity” of the application pool which you have
created)Change the application pool identity to custom account and click on set
button to provide the account credentials . once you have set the settings
, refresh/reset IIS to resolve the above error.
5. Access Denied:
The above error will pop up if the solution
directory (folder) doesn’t have required
To resolve the issue follow the
steps given in “500.19 : internal server error”
ConclusionIn this article we have learnt how to solve the issues which will occur while publishing ASP.NET Web API In IIS using Visual studio.