views:

408

answers:

5

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?

A: 

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).

Justin Niessner
All the logic is in a WebService class in a dll. The webservice is called by a Silverlight application, not sure how this would be done with a Controller?
Mark Redman
A: 

It should work outside the MVC-routing. Just creating a folder with the asmx-files should be sufficiant. I've got a 'webservices' folder inside my project, and it works great! No need to set the routing to ignore the path, the file does exists on the server.

Pbirkoff
+1  A: 

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.

Anders Fjeldstad
A: 

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.

Mark Redman
A: 

YES it does, I created the base project then I right clicked on the project name and added a webservice file with the demo of hello world in it. If you view that file in the browser it works fine.

John