简体   繁体   中英

ASMX Webservice - The test form is only available for requests from the local machine

I have an ASMX webservice with two functions. One sends a JSON object to the server and stores it in a file, while the other function retrives the JSON object from the server. The webservice works perfectly in local, but when I try it in a remote server, I get the well known "The test form is only available for requests from the local machine" error.

As suggested in different forums, I have added the protocols to my web.config file:

</system.web>
    <webServices>
      <protocols>
        <add name="HttpSoap12"/>
        <add name="HttpSoap"/>
        <add name="HttpGet"/>
        <add name="HttpPost"/>       
      </protocols>
    </webServices>
  </system.web>

Adding the POST protocol makes the second function (the one that retrives the object) available from remote, but the first one is still only available from the local machine.

I haven't been hable to find the solution to this problem, as every solution I found was just to add the protocols in the web.config file, which only work for one of the two functions.

There is one question which seems to have a similar problem, caused by using DateTime type as input parameter. In my case, maybe it has something to do with using a "Object" type as imput for the function? What alternatives do I have if I can't use the Object type?

Any suggestion will be helpful.

Thank you and best regards,

I had this same issue. VS 2012 did not publish the web.config to my published source after I added ws protocols. It worked when I manually copied the file.

发生这种情况的另一个原因是您的参数是更复杂的对象,包括GUID之类的东西

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM