Jun 19, 2018 01:31 PM|AnyUserNameThatLetsMeIn|LINK
Hi,
To publish an ASP.NET Core web service in IIS, I'm trying to get the steps sorted. I have it working on the development server and for testing I need to make that available on the same server. In Visual Studio it was running in IISExpress. During development
I was running the API in HTTPS under IISExpress.
Now I want to put it into IIS and I'm having trouble. I did a build release and published to a folder on the file system. I created the folder as E:\ACL\WebApi and that is where is published to. In that folder are 5 files.
This server is Windows 2016 and has IIS installed and it is up and running and has other web applications on it. When I applied that and went in to change the settings on IIS, each module I double click on, I get a dialog box up that says
There was an error while performing this operation
Details:
Filename:\\?\E:\ACL\ACLWebApi\web.config
Error:
I republished it in the same folder. I did everything it said. Clicking on any module gives me a read error on web.config. I've no doubt this is a permissions thing. Any ideas?
Try deploying a basic Core site that is not connected to a DB or service to make sure you have WebDeploy or whatever deployment process working.
This is what annoys me about MS documentation. What the above web site shows is not what I have. In Program.cs I have this:
public class Program
{
public static void Main(string[] args)
{
CreateWebHostBuilder(args).Build().Run();
}
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseKestrel()
.UseContentRoot(System.IO.Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>();
}
My config is the vanilla ASP core 2.1 created by the standard new project template. Or if, like me, you've been migrating from 2.0 to 2.1 preview to 2.1 rtm.
public static void Main(string[] args)
{
CreateWebHostBuilder(args).Build().Run();
}
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>();
}
Member
24 Points
174 Posts
Publishing a Web Api in IIS
Jun 19, 2018 01:31 PM|AnyUserNameThatLetsMeIn|LINK
Hi,
To publish an ASP.NET Core web service in IIS, I'm trying to get the steps sorted. I have it working on the development server and for testing I need to make that available on the same server. In Visual Studio it was running in IISExpress. During development I was running the API in HTTPS under IISExpress.
Now I want to put it into IIS and I'm having trouble. I did a build release and published to a folder on the file system. I created the folder as E:\ACL\WebApi and that is where is published to. In that folder are 5 files.
ACLWebApi.deps.json
ACLWebApi.dll
ACLWebApi.pdb
ACLWebApi.runtimeconfig.json
web.config
This server is Windows 2016 and has IIS installed and it is up and running and has other web applications on it. When I applied that and went in to change the settings on IIS, each module I double click on, I get a dialog box up that says
There was an error while performing this operation
Details:
Filename:\\?\E:\ACL\ACLWebApi\web.config
Error:
Any ideas?
All-Star
53001 Points
23587 Posts
Re: Publishing a Web Api in IIS
Jun 19, 2018 02:03 PM|mgebhard|LINK
I followed the deployment instructions from the ASP Core site, used WebDeploy and it just works.
https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-2.1&tabs=aspnetcore2x
Try deploying a basic Core site that is not connected to a DB or service to make sure you have WebDeploy or whatever deployment process working.
Member
24 Points
174 Posts
Re: Publishing a Web Api in IIS
Jun 19, 2018 02:04 PM|AnyUserNameThatLetsMeIn|LINK
I followed this:
https://stackify.com/how-to-deploy-asp-net-core-to-iis/
I republished it in the same folder. I did everything it said. Clicking on any module gives me a read error on web.config. I've no doubt this is a permissions thing. Any ideas?
Member
24 Points
174 Posts
Re: Publishing a Web Api in IIS
Jun 19, 2018 02:07 PM|AnyUserNameThatLetsMeIn|LINK
This is what annoys me about MS documentation. What the above web site shows is not what I have. In Program.cs I have this:
I added these:
.UseKestrel()
.UseContentRoot(System.IO.Directory.GetCurrentDirectory())
.UseIISIntegration()
As per the URL I posted to see if that worked.
Member
24 Points
174 Posts
Re: Publishing a Web Api in IIS
Jun 19, 2018 02:44 PM|AnyUserNameThatLetsMeIn|LINK
Thanks dude :)
All-Star
53001 Points
23587 Posts
Re: Publishing a Web Api in IIS
Jun 19, 2018 02:48 PM|mgebhard|LINK
Perhaps if you explain what you expect.
My config is the vanilla ASP core 2.1 created by the standard new project template. Or if, like me, you've been migrating from 2.0 to 2.1 preview to 2.1 rtm.
All-Star
53001 Points
23587 Posts
Re: Publishing a Web Api in IIS
Jun 19, 2018 02:51 PM|mgebhard|LINK
It take it, the site is running as expected.
Member
24 Points
174 Posts
Re: Publishing a Web Api in IIS
Jun 19, 2018 02:59 PM|AnyUserNameThatLetsMeIn|LINK
Yeah :)