当我从另一个 .NET 应用程序调用它时,我的 WebService c# 不起作用
My WebService c# doesn't work when I call it from another .NET application
这是我第一次在这里提问,所以,是的,如果您需要更多信息,请在此处回复!
所以,继续,我的问题出在我的 .NET 应用程序上,我为来自我创建的 Web 服务的 read/write 信息编码并且运行良好(在 VS2013 上测试)。
当我从浏览器调用它时,它工作得很好,但是当我从我的应用程序调用它时,它 returns 我出现以下错误:
The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'NTLM'
我确实尝试了很多东西,但没有找到任何解决方案。
我的下一步只是从 AD 服务器设置身份验证,换句话说,它应该只能在 Intranet 上工作。
我的配置文件是:
<system.web>
<authentication mode="None" />
<compilation debug="true" targetFramework="4.5.2"/>
<httpRuntime targetFramework="4.5"/>
而我的网络服务例程是:
public ImportFileClass ImportFile(string FileName, string PV)
{
try
{
ImportFileClass ipt = new ImportFileClass(PV, FileName);
ipt.DoEvents();
return ipt;
}
catch (Exception ex) { throw; }
}
提前致谢!
我发现了我的错误!
Add Service Reference
在添加服务引用时,我只是将我获得的 URI 放在 Web 服务上,然后进行确认。问题就在那里!
我执行了这些步骤并且一切顺利:
https://www.aspsnippets.com/Articles/Call-Consume-Web-Service-ASMX-in-ASPNet-web-application-using-C-and-VBNet.aspx
顺便说一下,非常感谢您的宝贵时间!希望对您有所帮助!
这是我第一次在这里提问,所以,是的,如果您需要更多信息,请在此处回复!
所以,继续,我的问题出在我的 .NET 应用程序上,我为来自我创建的 Web 服务的 read/write 信息编码并且运行良好(在 VS2013 上测试)。
当我从浏览器调用它时,它工作得很好,但是当我从我的应用程序调用它时,它 returns 我出现以下错误:
The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'NTLM'
我确实尝试了很多东西,但没有找到任何解决方案。
我的下一步只是从 AD 服务器设置身份验证,换句话说,它应该只能在 Intranet 上工作。
我的配置文件是:
<system.web>
<authentication mode="None" />
<compilation debug="true" targetFramework="4.5.2"/>
<httpRuntime targetFramework="4.5"/>
而我的网络服务例程是:
public ImportFileClass ImportFile(string FileName, string PV)
{
try
{
ImportFileClass ipt = new ImportFileClass(PV, FileName);
ipt.DoEvents();
return ipt;
}
catch (Exception ex) { throw; }
}
提前致谢!
我发现了我的错误!
Add Service Reference 在添加服务引用时,我只是将我获得的 URI 放在 Web 服务上,然后进行确认。问题就在那里!
我执行了这些步骤并且一切顺利: https://www.aspsnippets.com/Articles/Call-Consume-Web-Service-ASMX-in-ASPNet-web-application-using-C-and-VBNet.aspx
顺便说一下,非常感谢您的宝贵时间!希望对您有所帮助!