c# - 当我从另一个 .NET 应用程序调用它时,我的 WebService c# 不起作用
问题描述
这是我第一次在这里问,所以,是的,如果您需要更多信息,请在此处回复!
所以,继续,我的问题出在我的 .NET 应用程序上,我为从我创建的 Web 服务中读取/写入信息进行了编码,并且运行良好(在 VS2013 上测试)。
当我从浏览器调用它时,它工作得很好,但是当我从我的应用程序调用它时,它会返回以下错误:
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; }
}
提前致谢!
解决方案
我发现了我正在做的错误!
添加服务引用 在添加服务引用时,我只是把我得到的 URI 放在 web 服务上,然后确认。问题就在那里!
我做了这些步骤,一切顺利: https ://www.aspsnippets.com/Articles/Call-Consume-Web-Service-ASMX-in-ASPNet-web-application-using-C-and-VBNet.aspx
顺便说一句,非常感谢您的宝贵时间!希望能帮助到你!
推荐阅读
- c# - ASP.Net MVC Web 应用程序渲染视图与连续 Ping 异步
- java - 如何在java中检查用户输入是纯文本还是日期
- azure - Graph API User Delta URL
- c# - ASP.Net core how to secure connection string sensitive data in non Azure hosting
- java - 从字符串变量加载活动
- matlab - 自“0000 年 1 月 1 日”以来的序列号:这是 -1 BC 还是 +1 CE?
- python - 如何让所有用户与 Telebot 进行电报聊天或在 Python 中请求 lib?
- azure - 如何将环境特定值传递给 Azure 管道?
- android - 将进度条居中对齐
- javascript - 对数组进行反应映射并在 div 中返回