-2

I am making project in asp.net mvc3 and I have make a wcf webservice. I have to access database in wcf webservice. How i access controller class in wcf service method. if any other way to use then suggest me.

chetan singhal
  • 948
  • 1
  • 13
  • 36

2 Answers2

1

Why to you want to access the controller? That doesn't make any sense. Otherwise ASP.NET MVC & Web Services might help.

Community
  • 1
  • 1
0x434D53
  • 1,425
  • 12
  • 20
0

Hi instead of using Web Service you can use Web API. You can add web api by adding Web API Controller (v2 is good) and then you will see many auto implemented methods are there like get, post etc.

You can implement your code in those method or can built your own method. also if you want to give your custom url pattern to your methods then also you can do it by providing route config above the method.

And you can use your model classes in this webapi directly, so that you can save data into database.

Harsh Vyas
  • 316
  • 4
  • 13