简体   繁体   English

从另一个.NET应用程序调用时,我的WebService c#无法正常工作

[英]My WebService c# doesn't work when I call it from another .NET application

That's the first time I'm asking here, so, yes, if you need more information, reply here! 这是我第一次在这里问,是的,如果您需要更多信息,请在这里回复!

So, proceeding, my problem is on my .NET application that I coded for read/write information from a webservice I created and is working very well (tested on VS2013). 因此,继续,我的问题出在我的.NET应用程序上,该应用程序已编码以从我创建的Web服务读取/写入信息,并且运行良好(在VS2013上进行了测试)。

When I call it from a Browser, it works very well, but when I call it from my application, it returns me the error below: 当我从浏览器中调用它时,它工作得很好,但是当我从应用程序中调用它时,它返回以下错误:

The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'NTLM'

I really tried many things, and didn't find any solution for this. 我确实尝试了很多事情,却没有找到任何解决方案。

My next step is just to set the auth from the AD server, so in other words, it should work from intranet only. 我的下一步只是从AD服务器设置身份验证,换句话说,它仅应在Intranet上运行。

My Config file is: 我的配置文件是:

  <system.web>
<authentication mode="None" />
<compilation debug="true" targetFramework="4.5.2"/>
<httpRuntime targetFramework="4.5"/>

And my webservice routine is: 我的网络服务例程是:

public ImportFileClass ImportFile(string FileName, string PV)
{
    try
    {
        ImportFileClass ipt = new ImportFileClass(PV, FileName);
        ipt.DoEvents();
        return ipt;
    }
    catch (Exception ex) { throw; }
}

Thanks in advance! 提前致谢!

I've found the mistake I was doing! 我发现我正在做的错误!

Add Service Reference On adding the service reference, I just put the URI I got on web service and then confirmed. 添加服务参考在添加服务参考时,我只是将获得的URI放在Web服务上,然后进行确认。 The problem was exactly there! 问题就在那里!

I made these steps and went fine: https://www.aspsnippets.com/Articles/Call-Consume-Web-Service-ASMX-in-ASPNet-web-application-using-C-and-VBNet.aspx 我做了以下步骤,一切顺利: https : //www.aspsnippets.com/Articles/Call-Consume-Web-Service-ASMX-in-ASPNet-web-application-using-C-and-VBNet.aspx

By the way, thanks very much for your time! 顺便说一句,非常感谢您的宝贵时间! Hope it helps! 希望能帮助到你!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM