chobo2
chobo2

Reputation: 85775

Have a webservice and website in the same web root?

I have an asp.net mvc site and a asp.net web service. I am wondering if it is possible to have them in the same root(wwwroot) folder?

Like could I have

wwwroot -> all mvc files wwwroot -> webservice folder -> webservice files

Would this work?

I don't want them all mixed together and I am sure having 2 web configs in the same root probably would cause some problems.

Upvotes: 0

Views: 298

Answers (2)

backslash17
backslash17

Reputation: 5390

Rex M is right. You can also define a different IIS application to run in the webservice folder. In this way there is no problem about web.config file because the webservices are going to have their own. But take care, the applications are not going to share sessions neither other common objects, so you have to define application variables and objects twice.

Upvotes: 0

Rex M
Rex M

Reputation: 144122

You can definitely host web service endpoints (like ASMX?) in the same folder as an MVC application. You're right to suspect multiple web.config files won't work, but that shouldn't be necessary - you can combine unique entries from the two, and simply tell MVC to disregard requests to the specific ASMX files.

However, I'd suggest going one step further - combine the two if possible by bringing the logic of your web services into your MVC application, and have the MVC engine serve a SOAP response based on the type of request. This way you can dual-purpose your logic and give you a lot more flexibility down the road.

Upvotes: 1

Related Questions