Chris2222000
Chris2222000

Reputation: 67

Asmx web service 500 Error

I have a simple web service (asmx). I say simple because in the process of troubleshooting I have literally removed every line of code except the "Return" statement. The service has to do nothing but get the request and return a string.

I have tried 3 or 4 different methods of calling the web service and every time it returns an error: 500 error internal server error

If I go to the service url in my browser it loads just fine and shows me the method, request samples, etc.

Here is the code of my web service

<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class CalendarSyncService
Inherits System.Web.Services.WebService

<WebMethod()> _
Public Function SendXml(ByVal cBody As String) As String

    Return "Test"
End Function

End Class

The page never logs any errors and works in the browser so I am having a hard time troubleshooting it. Is there a reason why it would work in the browser but give me a 500 error when called through a httprequest, webrequest, soap, etc.?

Upvotes: 1

Views: 9768

Answers (2)

Hardy
Hardy

Reputation: 93

I had a similar problem where webservice runs on local server fine but on hosted server its returning 500 internal error. Just Add this in your web.config

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

Upvotes: 0

FarmerBob
FarmerBob

Reputation: 1354

Run Fiddler and inspect your calls to see what the difference is when you call it in a browser vs when you call it programmatically.

Upvotes: 0

Related Questions