ASMX Web服务500错误 [英] Asmx web service 500 Error

查看:991
本文介绍了ASMX Web服务500错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的Web服务(ASMX)。我说的简单,因为在排除故障的过程中我已经从字面上去掉除return语句code的每一行。该服务已做什么,但获得请求,并返回一个字符串。

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.

我试过3或4种不同的调用Web服务,并在每次返回一个错误时间的方法:500错误内部服务器错误

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.

下面是我的web服务的code

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

页面从未记录任何错误,并在浏览器中,所以我有一个很难排除它的作品。是否有一个原因,它会在浏览器中工作,但通过HTT prequest,WebRequest的,肥皂被调用时,等给我一个500错误。

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.?

推荐答案

我在哪里web服务对本地服务器正常,但托管服务器上其返回500内部错误运行一个类似的问题。
就在你的web.config添加此

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>

这篇关于ASMX Web服务500错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆