Web service / ASP.net project structure

davidsperling
davidsperling used Ask the Experts™
on
I have an ASP.net web application A. Now I'll write a web service S.
S needs to access a method in A.

What should the physical folder and visual studio project structures look like?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Reza RadConsultant, Trainer

Commented:
this design is very bad design!
if you have a functionality in a method of your web appliation A and you want to use it in your web service S, create another web service S2 and put the method there,
this is recommend to write your web services independent of web applications

Author

Commented:
Thanks for you're input :-)

The method in question is a db-function that maybe could be written as a stored procedure in the (oracle) database.
Say if I don't have the time to convert the method, could I have the service in a sub folder in the web app?
Ie the service's address would be http://myhost/ServiceFolder/MyService.asmx ?

In this case the design issue could be solved with a stored procedure eventually, but it can't be an uncommon scenario that you want info from a custom method in a web app, can it?

-And maybe you also don't want to use stored procedures for policy's sake. Or don't use a relational db at all.

>>...create another web service S2 and put the method there...
No, that would slow down and complicate the web app! :-)

So, more suggestions please!

Author

Commented:
[correction: "Thanks for your input"... ]

Is it acceptable to duplicate the method in A in S?
It's not very long...



OWASP: Threats Fundamentals

Learn the top ten threats that are present in modern web-application development and how to protect your business from them.

Reza RadConsultant, Trainer

Commented:
you can move the method to web service, then just use the method of S inside A.
if you have security issues on your webserivce, you can upload it on interanet site not internet, and if you want more secure, you can overlook webservice and use inline class in A.
of course there are security methods for web services which can help you write secure code

Author

Commented:
What do you think about the Stored Procedure idea?

Both A and S would call the same stored proc then.
Reza RadConsultant, Trainer

Commented:
it is good too,

Author

Commented:
Hmm, looking at the code, a stored procedure will be troublesome...

What's so wrong with having the service inside the web app?

Reza RadConsultant, Trainer

Commented:
>> What's so wrong with having the service inside the web app?
nothing is wrong
you can use service inside web app. but this will be internal web service. if you want just use it inside application so you can do it

Author

Commented:
So third party app couldn't use http://myhost/ServiceFolder/MyService.asmx then ?
Consultant, Trainer
Commented:
I think you can consume it from other applications,
the only thing is that every application that want to consume this service ,must use your application address, so you shouldn't change the address of application after this!

Author

Commented:
That's what I wanted to hear ;-)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial