Developer forum

Forum » Development » Service on DW
Dmitrij Jazel
Reply
 Hello everyone,

I have a question here, about web-services in Dynamicweb on the same server.
The service is pretty much straight-forward, it just speak to db and updates products in eCom.
(Security is considered)

The service must be accessible from the outside. And I can remember that there might be some problems with that...

Could anyone help with how should I do that properly, so I could use the service along with DW setup.

Regards,
Dmitrij

Replies

 
Pavel Volgarev
Reply
Hi Dmitrij,

Put the .asmx/.svc file into /Admin/Public folder (leaving the .dll file in the /bin folder). This will make your service available for everybody (even not logged in users).

-- Pavel
 
Dmitrij Jazel
Reply
 Hi Pavel,

Thanks for info and quick response...
But aren't you supposed to get 404 response when you are trying to call it?
Because it is not included (registered) in DW in any way?

Dmitrij

 
Pavel Volgarev
Reply
Hi Dmitrij,

Not sure I understand what you mean by "not included (registered) in DW". How do you want it to be registered?

-- Pavel 
 
Dmitrij Jazel
Reply
Well when you are working with custom modules (for example), before you can access your module, you must go to modules and "register" module with its system name. By saying registered - I meant something similar in mind.
But just to keep things simple, I will try to add the service, and than come back if I have any troubles with it :)
thanks so far...

Regards,
Dmitrij
 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply
Hi Dmitrij,

It works the other way around. Files that exist on disk are served by IIS. Only when the file does not exist does DW kick in, handle the 404 error and optionally redirect the user.

For custom modules this is different, as they are code files (*.cs or *.vb) that cannot be accessed directly. You need to register the module in order for Dynamicweb to be aware of it.

Hope this helps,

Imar
 
Dmitrij Jazel
Reply
 Hi Imar,

Thanks alot for explanation! :)

Regards,
Dmitrij
 
Dmitrij Jazel
Reply
 Hello again,

But what about live solution (hosted at HostNordic) I have access to Application and Files folders, but Admin folder is out of my reach.
I can contact HostNordic and ask them for help, but I am not sure if that is the way to go.
 
Morten Snedker
Reply

 Hi Dmitrij,

 

There is nothing for you to do in the Admin section of the file structure..

 

If a custom module has ASPX files, place these in a subfolder to the Application folder to make them accessible. Any code-behind will be DLL's that you drop in the bin-folder.

Clear or confused?

Regards
Morten Snedker

 
Dmitrij Jazel
Reply
Hello Morten,
The question is not regarding ASPX files, the question is regarding Web-Services and SVC file.
As Pavel wrote:
"Put the .asmx/.svc file into /Admin/Public folder (leaving the .dll file in the /bin folder). This will make your service available for everybody (even not logged in users)."
In the way that I am trying to setup a web-service on DW solution (live solution). And I want outside to be able to call it eventually (make a service-reference to it and send data basically).

Regards,
Dmitrij
 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply
This post has been marked as an answer
It's the same thing; you can drop asmx, aspx, svc files, whatever in the application folder and it'll work. Try this:

1. In Visual Studio, create a new Web Application
2. Add a service file (.svc, or asmx)
3. Add code to the service.
4. Compile
5. Drop the resulting assembly (from the new site's bin folder) into your website's bin folder (/Application/Bin)
6. Drop the ASMX or SVC file in/Application
7. Request www.yourdomain.com/YourService.asmx or YourService.svc

This should execute the code in the asmx or svc file and return whatever it's setup to return.

Hope this helps,

Imar
Votes for this answer: 0
 
Dmitrij Jazel
Reply
Hi Imar,
Thanks again,

Well it works fine now. I decided to use use .ASMX service instead of SVC and it worked.
For some reason I couldn't get web-reference to SVC.
But ASMX works great :-)

Regards,
Dmitrij

 

You must be logged in to post in the forum