如何解决我的项目中的403 HTTP / 1.1错误?

时间:2019-01-29 19:19:41

标签: c# asp.net asmx webhooks

我在项目中使用ASP.NET WebService(asmx)。 请检查我的代码:

[ScriptService]
public class Generic : System.Web.Services.WebService
{
....
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json,UseHttpGet =false)]
public void chatapi()
{
 System.IO.File.WriteAllText(Server.MapPath("~") + @"\TextLog\sample.txt", "Hello");
}
....
}

一个非常简单的代码,执行该代码将在该目录中创建sample.txt

我已将该方法设置为webHook,因此将在触发请求时执行该方法。 虽然我在日志中收到如下错误:

enter image description here

我尝试过的事情:

web.config

中设置以下内容
 <modules runAllManagedModulesForAllRequests="true"/>
 <validation validateIntegratedModeConfiguration="false" />

但是没有运气。 尽管当我从postman显式调用此方法时,它可以工作,但在发生(webhook)事件的情况下,它将生成一个403日志。 我已将网址设置为遵循http://domain.abc.xy/generic.asmx/chatapi

该如何解决?我在哪里做错了?任何帮助或建议将不胜感激!

0 个答案:

没有答案