更新时间:2023-01-17 12:12:55
感谢所有回复。令人惊讶的是,我设法修复了错误,但解决方案完全不是我所期待的。我必须在Service1.svc文件的标记中添加一个额外的属性:
Thanks for all the responses. Surprisingly enough, I managed to fix the error, but the solution was totally not what I was expecting. I had to add an additional attribute to the markup of the Service1.svc file:
Factory =System.ServiceModel.Activation.WebScriptServiceHostFactory
Factory="System.ServiceModel.Activation.WebScriptServiceHostFactory
我不确定为什么在构建项目时没有自动添加到文件中,但那就是它做了什么。我现在能够通过浏览器以及通过我调用Test方法AJAX请求没问题。
I am not sure why this wasn't automatically added to the file when the project was built, but thats what did it. I am now able to invoke the Test method through the browser as well as through my AJAX request with no problem.
再次感谢大家的帮助。