Solved

Error 405 - Method not allowed when trying to use a function via .NET Remoting under IIS

Posted on 2004-10-28
563 Views
Last Modified: 2013-11-25
Hi,

I am trying out an example found on Microsoft website. Look for vbremoting on google and you'll find it. I use VS .NET 2002, Upgraded to 2003 on XP pro - all service packs and patches installed except for xp2 (causing problems with my wireless network at home!). IIS Version? I assume 5.xxx. Whatever the version is with XP Pro.

It basically creates an object, and then shows you how to access this object via an asp.net service and via .net remoting.

I have no problems with the object being access via asp.net service, but I just can't get the .net remoting example to work. I keep getting error 405 - Method not allowed.

My laptop is kind of in an akward position as it is neither part of my domain at home nor is it at the office. Problem could be down to that but then it would not explain why it works with asp.net service!

I hope someone can help me out on that one. I have found various articles on the web and all are suggesting more or less the same thing but none of sorted out my problem.

I have uninstall ASP.NET via asp_netiis.exe -u, and re-install it via the -i, but no difference. I have added the asp.net user, vs studio user, internet user, etc... all with full access rights to the folder containing the project.

I have also modified web.config with various other settings, but no luck.

Anyone has faced this problem?

Thanks in advance.

Thierry
0
Question by:taf
    19 Comments
     
    LVL 96

    Expert Comment

    by:Bob Learned
    What security model does the web site use (anonymous, Windows authentication, form authentication)?

    Bob
    0
     
    LVL 96

    Expert Comment

    by:Bob Learned
    0
     

    Author Comment

    by:taf
    Hi Bob,

    Thanks for the feedback. Will check it out now.

    As for the security model, it seems to be anonymous, well at least based on the property of the virtual folder.

    I have now added the anonymous user to the folder that contains the code and to the bin folder that contains the dll, but it has made no chances whatsoever.

    Any other ideas? Thanks.

    Regards,

    Thierry
    0
     
    LVL 96

    Expert Comment

    by:Bob Learned
    What does the web.config file look like in the <identity> section?  What web site did you get the example from?

    Bob
    0
     

    Author Comment

    by:taf
    Hi,

    The section from <system.runtime.remoting> was added to the web config based on the requirements of the example.

    Here an exact copy of it:

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
      <system.runtime.remoting>
          <customErrors mode="On"/>
        <application>
            <service>
            <wellknown mode="singlecall" type="RemoteService,
            VoiceService.RemoteService" objectUri="RemoteService.rem" />
          </service>
          <channels>
            <channel type="System.Runtime.Remoting.Channels.Http.HttpChannel,
            System.Runtime.Remoting" />
            <channel type="System.Runtime.Remoting.Channels.Tcp.TcpChannel,
            System.Runtime.Remoting" />
          </channels>
        </application>
      </system.runtime.remoting>
     
      <system.web>

        <!--  DYNAMIC DEBUG COMPILATION
              Set compilation debug="true" to insert debugging symbols (.pdb information)
              into the compiled page. Because this creates a larger file that executes
              more slowly, you should set this value to true only when debugging and to
              false at all other times. For more information, refer to the documentation about
              debugging ASP.NET files.
        -->
        <compilation defaultLanguage="vb" debug="true" />

        <!--  CUSTOM ERROR MESSAGES
              Set customErrors mode="On" or "RemoteOnly" to enable custom error messages, "Off" to disable.
              Add <error> tags for each of the errors you want to handle.

              "On" Always display custom (friendly) messages.
              "Off" Always display detailed ASP.NET error information.
              "RemoteOnly" Display custom (friendly) messages only to users not running
               on the local Web server. This setting is recommended for security purposes, so
               that you do not display application detail information to remote clients.
        -->
        <customErrors mode="RemoteOnly" />

        <!--  AUTHENTICATION
              This section sets the authentication policies of the application. Possible modes are "Windows",
              "Forms", "Passport" and "None"

              "None" No authentication is performed.
              "Windows" IIS performs authentication (Basic, Digest, or Integrated Windows) according to
               its settings for the application. Anonymous access must be disabled in IIS.
              "Forms" You provide a custom form (Web page) for users to enter their credentials, and then
               you authenticate them in your application. A user credential token is stored in a cookie.
              "Passport" Authentication is performed via a centralized authentication service provided
               by Microsoft that offers a single logon and core profile services for member sites.
        -->
        <authentication mode="Windows" />


        <!--  AUTHORIZATION
              This section sets the authorization policies of the application. You can allow or deny access
              to application resources by user or role. Wildcards: "*" mean everyone, "?" means anonymous
              (unauthenticated) users.
        -->
        <authorization>
            <allow users="*" /> <!-- Allow all users -->

                <!--  <allow     users="[comma separated list of users]"
                                 roles="[comma separated list of roles]"/>
                      <deny      users="[comma separated list of users]"
                                 roles="[comma separated list of roles]"/>
                -->
        </authorization>

        <!--  APPLICATION-LEVEL TRACE LOGGING
              Application-level tracing enables trace log output for every page within an application.
              Set trace enabled="true" to enable application trace logging.  If pageOutput="true", the
              trace information will be displayed at the bottom of each page.  Otherwise, you can view the
              application trace log by browsing the "trace.axd" page from your web application
              root.
        -->
        <trace enabled="false" requestLimit="10" pageOutput="false" traceMode="SortByTime" localOnly="true" />


        <!--  SESSION STATE SETTINGS
              By default ASP.NET uses cookies to identify which requests belong to a particular session.
              If cookies are not available, a session can be tracked by adding a session identifier to the URL.
              To disable cookies, set sessionState cookieless="true".
        -->
        <sessionState
                mode="InProc"
                stateConnectionString="tcpip=127.0.0.1:42424"
              sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
                cookieless="false"
                timeout="20"
        />

        <!--  GLOBALIZATION
              This section sets the globalization settings of the application.
        -->
        <globalization requestEncoding="utf-8" responseEncoding="utf-8" />
       
      </system.web>

    </configuration>

    Thanks.

    T.
    0
     
    LVL 96

    Expert Comment

    by:Bob Learned
    And what what the source of this example?

    Bob
    0
     

    Author Comment

    by:taf
    Hi Bob,

    Sorry I missed that part.

    Here it is:

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnadvnet/html/vbnet10232001.asp

    Please note that they example is provided, but I did not use that. I wanted to re-type the code and see step by step what was involved. Maybe I omitted something, ,but I had a look at the sample and I can't see what if anything.

    Thanks.

    T.
    0
     
    LVL 96

    Expert Comment

    by:Bob Learned
    One small thing that I noticed in the config file:

    <service>
            <wellknown mode="singlecall" type="RemoteService,
            VoiceService.RemoteService" objectUri="RemoteService.rem" />
          </service>

    The example has VoicesService.RemoteService.  Was this a typo when you created the entries, or did you rename all the references for VoicesService to VoiceService?

    Bob
    0
     

    Author Comment

    by:taf
    Hi Bob,

    Sorry about delay, just came back from Haloween Party with kids.

    Back to the subject, this was on my part when I recreate the example, I did not spot 'VoicesService', so I ended up continuing with the one I created which was 'VoiceService'.

    Thanks.

    T.
    0
     
    LVL 96

    Expert Comment

    by:Bob Learned
    I just wanted to make sure that you were consistent with naming.  The web config file has this line:

    <authentication mode="Windows" />

    This is the note regarding this within the file:
    "Windows" IIS performs authentication (Basic, Digest, or Integrated Windows) according to
               its settings for the application. Anonymous access must be disabled in IIS.

    How was the Halloween Party? :)

    Bob
    0
     

    Author Comment

    by:taf
    Hi Bob,

    Walked from door to door with my children for 2 hours, then the rest of the evening was ours. Few drinks, good food and chatted for the rest of the night with a few friends. Nice but wrecking the day after when you still have to get up. Can't have it both way, well at least not anymore.

    Thanks for asking. Were you up to anything yourself?

    As for this, I actually spotted this when one of my colleague started to look at the same example. He's getting the same problem at the office. We spotted that and change the authentication to None to allow anonymous and we also tried it the other way i.e. Windows, but using the windows integrate and disabling anonymous, but we still got the same error at the office and I'm still getting it at home.

    I know when I modify the web.config authentication that it does kick in as I will get an error with the web services if I set the wrong authentication.

    Any other ideas?

    T.
    0
     
    LVL 96

    Expert Comment

    by:Bob Learned
    I am trying to teach myself ASP.NET, but since I have 15 years of experience in desktop applications, I am finding the arena a bit scary, kind of like a haunted mansion, full of dark places, dead ends, and pit falls.

    I try to get involved in more of these questions, to find out how far I can go, but sometimes, I run into a wall, like now.  I am fresh out of ideas for you.

    Bob
    0
     

    Author Comment

    by:taf
    Hey Bob,

    I really appreciate the effort. I'm a little bit in the same boat unfortunately. Experience in many areas, and not enough in others, thus me posting a lot of questions here. I'm sure I'll figure it out at some stage, if not I will get on to Microsoft about it.

    Thanks again for time and effort. Much Appreciated.

    Thierry
    0
     

    Author Comment

    by:taf
    Hi Bob,

    I though you'd be interested on this, but one of my colleague did all the hardwork and found this article on the microsoft web site which sorted out all my problems.

    http://msdn.microsoft.com/library/shared/comments/asp/threadbody.asp?aID=756868

    That's a lot of blody changes to get a small example to work????

    T.
    0
     
    LVL 96

    Expert Comment

    by:Bob Learned
    Could you please close this question?

    Bob "Cleanup Volunteer"
    0
     

    Accepted Solution

    by:
    PAQed with no points refunded (of 500)

    modulo
    Community Support Moderator
    0
     
    LVL 27

    Expert Comment

    by:Dabas
    Hi taf,
    Had exactly the same problem, and your solution here has saved me a few hours of work trying to figure this out.
    Am surprised at the "no points refunded recommendation" since you did supply an answer to your question, but I assume you are on premium, so it does not really matter.

    Are you using remoting in your applications, and what is your experience with it if you are?

    Dabas
    0
     

    Author Comment

    by:taf
    Hi Dabas,

    I am on premium indeed! It's worth the money in the long run espically when stock on issues like this. When I posted this question, I only started looking at it so I hadn't done much. Since then, since I'm extremely with day to day projects, I had a contractor doing a specific project for me, well at least to provide me with the basics I needed in relation .NET Remoting. I then modified the project to meet my full requirements.

    While this has been postponed again due to a large contract my company just got, I had to postpone .net once again. In any case, the bit I got through so far have been absolutely great. Very realiable and easy to setup. Much easier than DCOM. On the other hand I have not looked at encrypting the data with .NET remoting. Will do that later when I have more time.

    Just to give a brief of what I used .NET Remoting for: I have a set of services on various machine collecting data. I then have a service running on a central server that collects the data collected on the various machine using .NET remoting via a singleton object that stay permantly connected to the various other services. The beauty of it is though it is permently connected, not like DCOM, it never seems to loose its connection which for me is a life saver for this specific project. All I can say is that I do find it very usefull, very fast and easy to setup.

    Though to start at first, but once you do, it's no so bad after all. Discovering a few standard techniques is probably what you want to do and stick to them for a while until you discover how to improve them. That's what I did and it's seems to work whatever I do.

    The only thing I hope now is to be able to get back to it soon enough.

    Below is a website which I though had very good explaination of the various techniques that you can use using .NET remoting. Have a look at I. I highly recommend it. Very clear.

    http://www.dotnetjohn.com (.net remoting section)

    Best of luck.

    Later.

    Thierry.
    0
     
    LVL 27

    Expert Comment

    by:Dabas
    Thierry:
    Thanks for the long reply and for the link.

    I also found the book Expert One-on-One Visual Basic .NET Business Objects very useful. It is by the same author as the article that caused this question. (Without the obvious mistakes) It has a complete solution for any N-tier application with source code and detailed explanation, making extensive use of remoting for his purposes.
    ISBN 1-59059-145-3


    Dabas
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Course: Foundations of Front-End Development

    Jump-start a lucrative career in front-end web development, with zero previous coding experience required. This course covers the basic programming concepts and languages required for creating engaging websites from scratch.

    Suggested Solutions

    It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
    The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
    This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
    This video Micro Tutorial is the first in a two-part series that shows how to create and use custom scanning profiles in Nuance's PaperPort 14.5 (http://www.experts-exchange.com/articles/17490/). But the ability to create custom scanning profiles al…

    856 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now