1

I have a solution in ASP.NET Core 2.0 that has several shared class library projects and two web projects. The web projects are completely separate, but they use those same shared projects. The two sites need their own domain names, naturally. How should this be handled in IIS? I can't find any information regarding this scenario.

To clarify, the solution is laid out like below. Both web projects use all three of the shared projects, but the two web projects do not reference each other.

  • Shared Projects
    • MyApp.Core
    • MyApp.Data
    • MyApp.Services
  • Web Projects
    • MyApp.Web
    • MyApp.Admin

I need to run MyApp.Web at example.com, and MyApp.Admin at admin.example.com.

(Note: I'm not looking for detailed setup instructions, the docs have that covered pretty well. I'm just asking about the specific config for running multiple projects like this.)

2
  • 1
    As far as this goes, there's no difference from how you'd deploy any web application. When your web projects are published, they'll roll in all dependencies, so you don't actually "host" things like your class library projects. Those are just included as DLLs. You just create a site for each web project and drop the published code there. Then set the bindings for each site appropriately (for your domains). Commented Nov 7, 2017 at 14:06
  • @ChrisPratt Got it, that makes sense. Thank you! Commented Nov 7, 2017 at 15:23

1 Answer 1

1

In your scenario, you should create and deploy two websites in IIS.

When publishing with the dotnet publish command, all required dependencies are copied to the output folder (except the runtime in the default config, but even this can be changed).

You'll have just two independent websites that share code and libraries, but they don't interfere with each other. I have multiple similar deployments and encountered no issues, even netcoreapp1.1/netcoreapp2.0 run alongside without problems.

If you're using EntityFramework (or something similar for database access), you should chose to delegate database migrations to a single project.

Sign up to request clarification or add additional context in comments.

1 Comment

Okay, this makes perfect sense. I thought about this way but wanted to verify there wasn't anything better. Thanks a ton!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.