Gavin
Gavin

Reputation: 5871

Sharepoint denying access to asmx methods

We have a site running on MOSS 2007 which makes calls to custom web service asmx methods on the same domain from the client.

On the live site requests are getting redirected to the following url:

http://[domain]/_layouts/error.aspx?ErrorText=Request format is unrecognized for URL unexpectedly ending in %27%2FIsSuspectWaterLevel%27.

We've added the following to the sites web.config without any joy:

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

Interestingly enough we don't have this issue on the test server which is supposed to be pretty identical to the live server.

Any ideas to what other variable might be at play here?

Thanks in advance for any ideas, Gavin

Update:

While a call to

http://[Domain]/_vti_bin/Custom/CustomFunctionality.asmx/IsSuspectWaterLevel

fails, I can still access

http://[Domain]/_vti_bin/Custom/CustomFunctionality.asmx?op=IsSuspectWaterLevel

though it fails when I invoke the method in the same way.

I wonder if this helps shed more light on the issue?

Another Update:

I've just observed the same error on the dev server. Removing the apps dll from GAC and then re-copying it in solved the issue. The live server tested fine with initial deployment so perhaps there's an issue with Sharepoint loosing some reference over time? Clutching at straws as very confusing behaviour!

Yet Another Update:

It seems everytime I touch (open and save) the web.config file in 12 Hives the problem is fixed again for a period, but after a while the problem comes back. I wonder if it's anything to do with the app pool being recycled?

C:\Program Files\Common Files\microsoft shared\Web Server Extensions\12\ISAPI\web.config

Upvotes: 2

Views: 1098

Answers (1)

Gavin
Gavin

Reputation: 5871

An inelegant workaround to this issue that works for us: We've swapped out the web service asmx end point for a web handler ashx endpoint. This doesn't suffer the same issue for some reason.

I'm guessing from this that there's some issue creeping in after a period of time which is causing urls to resolve incorrectly. I suspect that the / after the .asmx in the url is the curprit. The ashx endpoint implemented is working purely on url parameters and posted data.

Obviously this work around won't always be an option for others who might experience the same issue as we're loosing a lot of the rich web service functionality that's pre-baked in to an asmx endpoint.

Unfortunately I won't be able to test any other solutions that people might put forward from now on as we've moved away from the web service asmx approach. Sorry.

Upvotes: 1

Related Questions