[Mono-list] Webservise Discovery Language

Ben Clewett ben at roadrunner.uk.com
Wed Nov 8 06:46:04 EST 2006


Kornél,

I am making progress.  You code seems to work well, I've just got to 
tidy it a bit.

You asked me to report a bug if a change in the Web.config is not 
respected by mod_mono without a restart.  I think I have a candidate for 
a bug:

I have added this to Web.config:

<system.web>
   <webServices>
     <protocols>
       <remove name="Documentation"/>
     </protocols>
   </webServices>
   ....
   ....
   ....
<system.web>


This is not respected without a restart.  But otherwise works well.

-----------<>------------

Secondly.

For use of other members, I have found this great code snipit for 
Global.asax:

protected void Application_BeginRequest(Object sender, EventArgs e)
{
   string requestPath = Request.RawUrl.Trim().ToLower();
			
   if (!my_static_global_flag) {
     if (requestPath.IndexOf("?wsdl") > 0 ||
         requestPath.IndexOf("?disco") > 0)
       throw new HttpException(404, "Access Denied.");
   }
}

This also helps give me good control over visibility of my webservices.

-----------<>------------

Thanks for the help,

Ben




Kornél Pál wrote:
> Hi,
> 
> I attached a reference implementation in 
> OptionalDiscoveryRequestHandler.cs.
> 
> You can control it using the internal 
> OptionalDiscoveryRequestHandler.EnableDiscovery field.
> 
> The only thing you have to do is to compile the handler to a DLL (don't 
> require it's own assembly, you can put into any existing assembly) and 
> reference this type in Web.config instead of 
> System.Web.Services.Discovery.DiscoveryRequestHandler.
> 
> Kornél
> 
> ----- Original Message ----- From: "Ben Clewett" <ben at roadrunner.uk.com>
> To: "Kornél Pál" <kornelpal at gmail.com>
> Cc: <mono-list at lists.ximian.com>
> Sent: Tuesday, November 07, 2006 7:05 PM
> Subject: Re: [Mono-list] Webservise Discovery Language
> 
> 
>> Kornél,
>>
>> I am very exited about your suggestion, I think this is exactly what 
>> I'm looking for.
>>
>> But this level of experience is way about my knowledge.  If you could 
>> share this, I would be interested.
>>
>> Many thanks,
>>
>> Ben
>>
>>
>> Kornél Pál wrote:
>>> ASP.NET applications should reload automatically on Web.config change 
>>> so there should be no need for restarting mod-mono-server (if you 
>>> mean that on mono). If you have a problem like that please file a bug 
>>> report.
>>>
>>> If you mean the Web.config modification described on 
>>> http://msdn2.microsoft.com/en-us/library/tewz1055.aspx in "To enable 
>>> dynamic discovery for a Web service" I suggest you to create your own 
>>> IHttpHandler implementation that wraps 
>>> System.Web.Services.Discovery.DiscoveryRequestHandler and that will 
>>> make you able to disable it based on static fields or your own 
>>> configuration files. If you use this method I can send you a simple 
>>> implementation of this.
>>>
>>> You are using some other Web.config settings please let me know what 
>>> exactly do you use.
>>>
>>> Kornél
>>>
>>> ----- Original Message ----- From: "Ben Clewett" <ben at clewett.org.uk>
>>> To: "Kornél Pál" <kornelpal at gmail.com>
>>> Cc: <mono-list at lists.ximian.com>
>>> Sent: Tuesday, November 07, 2006 6:41 PM
>>> Subject: Re: [Mono-list] Webservise Discovery Language
>>>
>>>
>>>> Kornél Pál wrote:
>>>>> Web.config is intended to do configuration. What exactly is your 
>>>>> problem with that?
>>>>
>>>> Hi Kornél,
>>>>
>>>> Thanks for the reply.
>>>>
>>>> I have six servers to manage.  We sometimes release ten version of 
>>>> code a day, which over-write the Web.config.  Editing this file is 
>>>> potentially dangerous.  After an edit, I have to re-start the mono.
>>>>
>>>> My feeling is that this file must be interoperated by some part of 
>>>> the Mono suit (stop me if this is wrong.)  It would be much better 
>>>> for me if control could be administered by some simple flag.  Or 
>>>> even a static public variable in mono.
>>>>
>>>> If this is not possible, it's not so important.  I am just 
>>>> interested to know if there is an alternate method.
>>>>
>>>> I can't be the only member who would like better control of this. 
>>>> Alternatively, do any members have scripts to toggle the Webservice 
>>>> Discovery which are safe and fast?
>>>>
>>>> Thanks again,
>>>>
>>>> Ben
>>>>
>>>>
>>>>
>>>>
>>>>>
>>>>> Kornél
>>>>>
>>>>> ----- Original Message ----- From: "Ben Clewett" 
>>>>> <ben at roadrunner.uk.com>
>>>>> To: <mono-list at lists.ximian.com>
>>>>> Sent: Tuesday, November 07, 2006 5:38 PM
>>>>> Subject: [Mono-list] Webservise Discovery Language
>>>>>
>>>>>
>>>>>> Sorry if this has been asked many times before....
>>>>>>
>>>>>> We develop ASP-Webservice code, which runs better than perfect on 
>>>>>> Mono.
>>>>>>
>>>>>> On our development system, we want the Webservice Discovery turned 
>>>>>> on.
>>>>>>
>>>>>> On our live systems, we want it optionally turned on.
>>>>>>
>>>>>> The only way I know of doing this is to edit the Web.config file.
>>>>>>
>>>>>> But this is messy, if done badly can crash the webservice, it has 
>>>>>> to be
>>>>>> done on every release and every time we want to toggle this option.
>>>>>>
>>>>>> Do any of your members know a simple and elegant method for 
>>>>>> toggling the
>>>>>> Webservice Discovery visibility?
>>>>>>
>>>>>> Thanks for your help,
>>>>>>
>>>>>> Ben.
>>>>>>
>>>>>> _______________________________________________
>>>>>> Mono-list maillist  -  Mono-list at lists.ximian.com
>>>>>> http://lists.ximian.com/mailman/listinfo/mono-list
>>>>>
>>>>
>>>
>>
> using System.Web;
> using System.Web.Services.Discovery;
> 
> namespace MyNamespace
> {
>     public class OptionalDiscoveryRequestHandler : IHttpHandler
>     {
>         internal static bool EnableDiscovery;
> 
>         public OptionalDiscoveryRequestHandler()
>         {
>         }
> 
>         public void ProcessRequest(HttpContext context)
>         {
>             if (!EnableDiscovery)
>                 throw new HttpException(403, "Forbidden");
> 
>             new DiscoveryRequestHandler().ProcessRequest(context);
>         }
> 
>         public bool IsReusable
>         {
>             get
>             {
>                 return true;
>             }
>         }
>     }
> }
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list



More information about the Mono-list mailing list