Home > Mobile >  ASP.net Core Web API Publish just creates a web.config file and nothing else
ASP.net Core Web API Publish just creates a web.config file and nothing else

Time:04-22

I want to "publish" my ASP.net Core Web API application (.netCore 6) on my local desktop running IIS 6, for testing using Postman. I am using VS2022 community.

I know I can run the project in the background and test it via Postman, which works fine, but I want to do an actual Publish to IIS (locally due to current Production server issues).

Why is it when doing a publish to folder, I only get a web.config file created? Nothing else gets created/copied into the destination folder, such as DLLs, etc.

Do I have to manually copy the contents of my Bin folder into the IIS destination folder?

What steps am I missing here?

This is the web.config VS creates:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <location path="." inheritInChildApplications="false">
    <system.webServer>
      <handlers>
        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
      </handlers>
      <aspNetCore processPath="dotnet" arguments=".\ShippingSchedulerAPI.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
    </system.webServer>
  </location>
</configuration>
<!--ProjectGuid: A9BB5804-BDDB-4AB1-B52A-189555DBEA14-->

Thanks

UPDATE

Nothing is working from VS2022 nor the command-line dotnet publish.

I've deleted the BIN and OBJ folders, and the .VS folders, to start again. Cleaned and re-compiled and deleted the Publish profile.

I've created a folder under inetpub\wwwroot\myAPI and re-published to the new location as a File publish.

All I get is a web.config and nothing else.

Any ideas please?

CodePudding user response:

I found the problem to be inside the project properties' Debug profiles.

Project --> Properties --> Debug --> Open debug launch profiles UL

I went into my project's default profile and removed the App URL field entries. There were several in there (I don't know how that happened):

https://localhost:7043;http://localhost:5043

Once I removed the field, cleaned, recompiled and Published, all the required DLL and other files were created into the destination IIS folder.

Also, as an extra "check", I ticked the Delete all existing files prior to Publish option.

  • Related