I have just tried adding a WebService (asmx based) from a WebForms project to a new MVC project. I cant seem to get to the asmx webservice in IE?
In MVC should this work the same, I have the service in a Services folder, should this be in a View or should this asmx work outside the 'MVC' routing?
Update:
I set up the WebService initially dropping in the .asmx file onto a test server, recently setup with .Net 4.0 for the VS2010 MVC 2 project. (Windows Server 2003 IIS 6)
The same Webservice is on a development (VS 2010) machine is viewable? Any ideas on the difference, possibly a setup issue?
According to Scott Hanselman, the request is by default not handled by the ASP.NET MVC routing mechanism:
Why doesn't ASP.NET MVC grab the request? Two reasons. First, there's an option on RouteCollection called RouteExistingFiles. It's set to false by default which causes ASP.NET MVC to automatically skip routing when a file exists on disk. (Source)
Which would indicate that there is a problem somewhere else.
If you want the quick/easy/dirty solution, pull the ASMX Service out of the MVC Routing somehow.
If you want to do things the better way, pull the logic out of the ASMX service and create a new page for it in your MVC application. You can then implement the logic in your Controller and allow the View to handle returning the SOAP message (or you could go with JSON depending on who is consuming the service).
Answering my own Question..
I can see WCF services when creating a basic service (and cannot see asmx services)
Since WCF is considered the way to go anyway, I am doing that.
I didnt persue getting the asmx to work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With