Building Release/Publish doesn't create web.config for .NET Core, Razor Pages website


Until now I have developed .NET Core applications (with C#) using Visual Studio for Mac, but I want to migrate to Fire/Swift. I’m currently testing / evaluating everything.

When I do a Release / Publish build, the necessary web.config file isn’t created. What am I missing here?


what specific error/problem do you get? I would expect a Web.config to be optional and/or be provided by the main IIS site. How/where are you deploying this?

I get the error “403 - Forbidden: Access is denied”. It’s the kind of error that you get when IIS can’t find a default file to load.

It’s a shared webhosting supporting PHP, ASP.NET and .NET Core.

I guess the web.config is needed to let IIS decide between ASP.NET and .NET Core. Eg. a web.config is also needed to specify the PHP version when it’s a PHP site.

I’ve now created the web.config myself (modified copy of other site). The only thing it basically does is referring to the Core DLL.

It would be nice if the build would do that for me.


Gotcha. So simply adding the Web.config file did the trick? Can you send me the file you sued, for reference? Also, for the VC# project, where does the file come from — is it in the original project, or is iot generated entirely automatically from nothing, by the build?

Yes. I copied the contents of the Release folder, created by Fire. I only created the web.config file, which is a modified copy of the Publish made by VS Mac. I’ve checked the project folder, in VS Mac, and didn’t saw a web.config file there. Also not in bin/Release. It’s only created when doing a Publish (bin/Release/Publish folder).

<?xml version="1.0" encoding="utf-8"?>
  <location path="." inheritInChildApplications="false">
        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
      <aspNetCore processPath="dotnet" arguments=".\RazorWeb.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
<!--ProjectGuid: 65FEDDF0-C45C-48EF-935B-F9C925318812-->

The only thing I changed is the value of the attribute “arguments” in the “aspNetCore” element. That’s all. Of course I don’t know for sure if in some scenario’s other values have to be added, but I honestly think this is all what IIS needs to know.

1 Like

I assume RazorWeb.dll is your project’s name and AspNetCoreModuleV2 is a hardcoded value with no relation to your project?

Yes, you’re right. RazorWeb.dll refers to the DLL created by Fire.

AspNetCoreModuleV2 is hardcoded; don’t know where “V2” stands for and if that will change in the future though (eg. V3).

1 Like

vNext will generate the file for you — feedback appreciated of it works as you expect…

You mean in the next upcoming preview?

I’ll let you know how it’s working out. Thanks! :+1:

Yes, Friday’s build. I can also send you one earlier, iff you prefer. Fire, Water or VS?

I’m only working on macOS, so it’s Fire. But it isn’t necessary to have it before Friday. I already created the web.config myself.

I’ll test the automatically created one after Friday.

1 Like

Just tested it and it works beautifully. I didn’t have to add/change anything.

Thanks! :slight_smile:

1 Like

Glad to hear!