views:

37

answers:

2

Hi

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.

+1  A: 

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.

Rex M
Ah that answers one of my questions I had about how to stop duplicate code. Since alot of my webservice stuff uses alot of the same files as my asp.net mvc application does. However this will be down the road.
chobo2
For now I am looking for the easiest way that will have my 2 apps separate but in the same root
chobo2
A: 

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.

backslash17
How do I do this? I am on a shared hosting plan so not sure if I have rights to do this.
chobo2
In shared hosting all you need to do is to create a subdomain in your account. It get the name with the form of subdomain.yourdomain.com and it is going to work as a different application.
backslash17