Integration of ASMX Web Service (Port 80)

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
5/14/2009 1:30:57 AM
Gravatar
Total Posts 31
There are 10 kinds of people in the world, those who know binary, and those who don't

Integration of ASMX Web Service (Port 80)

I would like to provide a web service on port 80 under the folder tree of MojoPortal, or in any way that allows it to have a URL under the same domain as the MojoPortal web site domain (host name) itself.

When I place my original solution under the MojoPortal folder structure (just by creating a new folder in the tree) and place the application there, and create a new web application in IIS there, it does not work. I see the error page with ""We're sorry but a server error has occurred while trying to process your request.".

It works fine when I place it on another IIS Web Site on another port which is separate from the MojoPortal site, but then, it would be better to use port 80.

So, question is, is it possible in any way to provide a Web Service (ASMX) on a URL somewhere under the root of the web site, or on any other custom URL on the master web site? (e.g. if the site is available on http://mysite.com/service/theservice.asmx and mysite.com/ is the root folder of the MojoPortal web site).

Suspecting that MojoPortal traps/intercepts the request somehow before it reaches the Web service, alternatively, there are some conflicts of the web.config settings between my sub-folder's Web.Config for the web service and MojoPortal's own web.config...

Advice would be appreciated.

5/14/2009 5:51:00 AM
Gravatar
Total Posts 18439

Re: Integration of ASMX Web Service (Port 80)

I would do it without adding a sub appication. As long as the .asmx file exists and the dlls are in the /bin folder it should work fine.

I would use the mojo source code, create a custom .sln file (you can remove the data projects you aren't using if you only use 1 db platform), add a Web Application project for your web service(s) and use post build events to copy the needed files up to the web folder in appropriate places (we do this for the mojoPortal.Features.UI and WebStore.UI projects so you can see example project structure and post build events there).

If you need any config settings add them to the mojoportal Web.config. Be sure that your psot build event doesn't overwrite any mojoportal existing files.

Hope it helps,

Joe 

5/26/2011 5:58:50 AM
Gravatar
Total Posts 30

Re: Integration of ASMX Web Service (Port 80)

It just seems like a really big workaround to require a user to download the entire source just to deploy a web service.  Isn't there some way to just say "ignore XYZ" URL where XYZ contains a web service?

5/26/2011 6:41:41 AM
Gravatar
Total Posts 18439

Re: Integration of ASMX Web Service (Port 80)

Seems like you are working from 2 false assumptions

1. that it is not possible to deploy a .asmx web service without using mojoPortal source code. This is not true I could do it easily. The main benefits of working with the mojo source code is that you can learn how it works and there is a treasure trove of good example code to reference.

2. that mojoPortal somehow interferes with the url for your .asmx and you need a way to "ignore" it. This is simply not true. Our url rewriter will run in the context of the request for the .asmx file but the request will not match any friendly url and the rewriter module will not rewrite the request.

Hope that helps,

Joe

5/27/2011 2:30:08 AM
Gravatar
Total Posts 30

Re: Integration of ASMX Web Service (Port 80)

You're right, I was working form those those assumptions, and I'm not entirely convinced I'm wrong with the second one.

I'll start by explaining what I'm trying to achieve, and then detail the issues I'm having.

I want to create creating a web service off my main domain name:

As an example: http://mydomain.com/MyWebService/WebService.asmx

 

I'll just start off by saying I DID get the web service to work.  However, I needed to put it into the root folder and make sure I didn't deploy Web.config over Mojo portal's web.config.  But this isn't what I wanted - I wanted to put web services in their own distinct locations.  Anyway - this confirms that first point you were saying - I don't need the whole source code.
 

My second assumption was made because I can't deploy the web service to any other folder than the root folder.  For instance, I publish to a sub-folder (going through the standard IIS steps too) and I get an error message every time:

Attempt to access the following service: http://prlsoftware.com/Erodite/ExceptionLogger.asmx?wsdl

I get this shown in the address bar: http://prlsoftware.com/Error.htm?aspxerrorpath=/Erodite/ExceptionLogger.asmx

"We're sorry but a server error has occurred while trying to process your request.

The error has been logged and will be reviewed by our staff as soon as possible. It is possible that the error was just a momentary hiccup and you may wish to use the back button and try again or go back to the home page."

 

This is the same error that the original poster had which is how I found this site.  This is from the standard Error.htm/ErrorPage.aspx for Mojoportal (hence the assumption that Mojoportal was involved).

Also - there is no entry in the System Log - so I'm not sure where it is "logging" this error to.

Anyway - this error was useless to me so I turned CustomErrors off and then it gives me this:

Could not load file or assembly 'mojoPortal.Web' or one of its dependencies. The system cannot find the file specified.

In other words, it was my assumption that mojoPortal is somehow attempting to come in (maybe with the url rewriter) but failing to load due to the fact that mojoPortal doesn't actually exist in this web application (i.e. none of the mojoportal DLLs are there).

So I went through the process of adding in one by one the files it asked for (well, said were missing).

After adding 5 DLLs it said: it couldn't locate:

E:\web\prlsoftware\htdocs\Erodite\Data\Sites\1\systemfiles\sitesettingscachedependecy.config

In other words, to get this to work I would have to have almost an entire duplicate copy of mojoPortal in my sub-application folder just so my sub application would work.  Although I guess this is possible, it isn't a realistic option, especially if I want to have a number of sub-application folders.

I'm happy to put my hand up here and say that I'm just getting started on this and I might be making a newbie mistake.  However, by all appearances it DOES look like mojoPortal is interfering with the URL for my .asmx and is blocking me from adding sub-folders and sub-applications to a domain managed by mojoPortal.

Cheers,
Philip

P.S. I have VS 2008 and my company is only just now in the process of upgrading to 2010 which is why I haven't gone down the Source Code option.

5/27/2011 4:38:01 AM
Gravatar
Total Posts 108
Community Expert

Re: Integration of ASMX Web Service (Port 80)

Please read the following dev-FAQ   http://www.mojoportal.com/developer-faq.aspx

I think that You have a Web.config conflict, is usual when you deploy multiple .net application in the same domain.

5/27/2011 1:05:46 PM
Gravatar
Total Posts 18439

Re: Integration of ASMX Web Service (Port 80)

There are basically 2 approaches you could take in deploying your service(s).

If it is a stand alone service and has no dependencies on mojoPortal then you could deploy it in a sub folder where the sub folder is configured as its own application in IIS and it has its own /bin folder, Web.config file etc. In this case then you would probably have to mitigate Web.config conflicts as described in the Developer FAQ.

If you want your services to run in the same application context as mojoPortal. Then put your dlls in our /bin folder and put your .asmx files in a folder of your choosing (the folder does not need to be configured as an app in IIS and in fact should not be). If you need some custom Web.config settigns add them in our Web.config.

But understand that the Visual Studio publish feature is designed to package it for the first scenario, it doesn't know how to deploy it into an existing app where other code is already running. Manual deployment in this case should be pretty straightforward and easy so the use of the VS publish feature is just complicating it. Probably it is deploying the dlls in the /bin folder beneath the folder where you want to publish it when they really need to go in the /bin folder under the root. That would certainly cause errors.

Hope that helps,

Joe

 

5/28/2011 3:19:54 AM
Gravatar
Total Posts 30

Re: Integration of ASMX Web Service (Port 80)

Thanks everyone again for all of your help.  In case anyone else stumbles across this thread the short answer is to block the inheritance:

http://www.kowitz.net/archive/2007/05/16/stopping-asp.net-web.config-inheritance

 

Thanks particularly for the link to the FAQ - however because I'm new to this I didn't realise it was a Web.config conflict, I thought it was mojoPortal "taking over".

Thanks again - it's all good now.

You must sign in to post in the forums. This thread is closed to new posts.