How to host a WCF service in a reference DLL via the MVC website?

I hope the title is clear enough.

I have 2 projects, MyProject.Website (ASP.NET MVC3 Front End) and MyProject.WcfService. When I host a website, I would prefer not to host two websites inside IIS, I would like to be able to host only MyProject.Website and MyProject.WcfService inside this link.

I know I can do this through ServiceHost, which should work, but is there a better way?

+8
c # asp.net-mvc-3 wcf
source share
1 answer

Check out this post where I looked at how you can host a wcf service dll

Create, Host (Self Hosting, IIS hosting) and use the WCF service

IIS hosting

  • To host the same WCF library in your application, create a WCF web application project using the WCF web application.
  • Delete the files created in the IService.cs and Service.cs file from the App_Code folder.
  • Include the WCF * .dll library that we created.
  • Open the Service.svc file and change one line in it.

    - <% @ServiceHost Language = "C #" Debug = "true" Service = "WcfServiceLibrary.Service1"%>

  • Modify the WEB.Config file of the web service to open the service to the client. then you need to create the same element as described above in the app.config file of the service library.

+10
source share

All Articles