开发者

How do I set up a WCF service and MVC site to share the same SSL certificate?

开发者 https://www.devze.com 2023-01-17 15:48 出处:网络
I have two projects, one is a WCF service, the other is an ASP.NET MVC site.The service is to be exposed to multip开发者_开发知识库le consumers, including my MVC site.Both the site and the service req

I have two projects, one is a WCF service, the other is an ASP.NET MVC site. The service is to be exposed to multip开发者_开发知识库le consumers, including my MVC site. Both the site and the service require access over SSL. I only have one SSL certificate I can use.

Any ideas how I can set these two projects up in IIS?

Thanks in advance.


One idea is to get a wildcard SSL certificate, something like *.mysite.com, and then set up 2 sites with URLs like services.mysite.com and www.mysite.com. You will be able to assign the same SSL cert to both sites. Only catch is that you'll need to use different a different IP or port on one of the sites, otherwise IIS won't know which site is being routed


I think I have solved it. Thanks for your input JonoW.

  1. I created the MVC site and bound the SSL certificate as normal.
  2. I then created a subdirectory in the site and copied all my WCF files there.
  3. In IIS I browsed to the new subdirectory, right-clicked 'Convert to Application'
  4. I had to copy some assemblies used by my site to the the bin folder of my WCF directory to avoid some 'assembly not found errors'
  5. I also had to remove/rename some configuration settings in the WCF web.config that had the same keys as configuration settings in my site web.config.

Finally I updated my endpoint binding configurations and it all seemed to work.

Relatively straight-forward in the end. :)

0

精彩评论

暂无评论...
验证码 换一张
取 消