web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

NAV 2009 WebService Connection Refused

(0) ShareShare
ReportReport
Posted on by

Hi all, i'm not sure my problem's cause is strictly related to NAV but here is where i'm starting from. 

I'm developing a Web Form application with .NET framework 4 which calls some functions from NAV codeunits exposed as WebServices. I have already done 3 or 4 other projects like this and all went more or less fine, only on this last project i encountered this error and i can't understand whats the cause and how to solve it. I have already spent 2 days reading all forum posts on this matter, and i see there are many, but still cant find a solution.

I'll try to provide some data about the problem as detailed as possible. 

ERROR

Stack Trace: 


[SocketException (0x274d): No connection could be made because the target machine actively refused it 127.0.0.1:7047]
   System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) +273
   System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception) +584

[WebException: Unable to connect to remote server]
   System.Net.HttpWebRequest.GetRequestStream(TransportContext& context) +1176
   System.Net.HttpWebRequest.GetRequestStream() +23
   System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) +160
   EuroFer.WSref.WebAppUtils.GetItemPrice(String itemCode, String customerCode, Int32 itemQuant) +146
   EuroFer.InsertOrder.btn_searchItem_Click(Object sender, EventArgs e) +591
   System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +153
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3804

 

NAV


Version 2009 SP1

Codeunit succesfully published as webservice

"Dynamics Nav Business Web Services" service is running

NETWORK & SECURITY

NAV Server is running on server A, while my project is published with IIS in server B, both A and B are inside company network.  
I contacted their system admin who said there are no firewall, router or proxy rules blocking the connecction.

Note: If i copy the link to the webservice in my project reference and i paste it in the browser i actually get a good answer, it shows me the xml fiel with all the functions i'm supposed to see. 

CODE

I Added the reference to the project as usual, indeed its all working fine while i'm previewing it from visual studio in debug mode, the error arises when i publish the application on IIS.

Any ideas ? 

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Community Member Profile Picture
    on at

    Try to execute your Project (Web Service) from Server A (NAV Server) and see if it works.

    This will ensure that, there is nothing wrong in your code except the Firewall settings.

    Also, use proper IP Address (Instead of Local host) , check if proper rights are given in domain, NAV & SQL.

  • Suggested answer
    Suresh Kulla Profile Picture
    50,243 Super User 2025 Season 2 on at

    Try SOAPUI tool to test the connection and also try using IP address if you are using the name.  You already mentioned that you have checked the proxy rules, but try to check if the webservice port is open or not.

  • cuge Profile Picture
    on at

    Thankyou for your answers, in my service reference i'm not using localhost actually i set the specific internal address, like: 10.xx.xx.x/.../WS*comapny name*/Codeunit/WebAppUtils.

    Typing this same address on the browser gives me a correct response, so i guess the port is open and working fine, we also tried a telnet request on that port before and was already fine.

    About SQL permissions, our users and ntauthority service got db_owner rights.

    To test the application from NAV server i'll have to install IIS there, so i will try Monday i think, meanwhile i'll check this soapui tool.

  • Suggested answer
    Alexander Ermakov Profile Picture
    28,096 on at

    Check also the antimalware software, sometimes it is an issue.

  • Suggested answer
    RockwithNav Profile Picture
    8,600 Super User 2025 Season 2 on at

    Some of the most common Solutions for above are.

    1. Firewall Settings

    2 .Antivirus with Firewall

    While doing on VM you need to cross-check that the Port is open.

  • cuge Profile Picture
    on at

    Ok, i got some updates on this topic, today i installed IIS where Nav server is running and so i could try to run the application there, i thought it would work but actually i got a similar error, even if this time is probably telling us more:

    [SoapException: The login failed when connecting to SQL Server 10.16.103.9.]
       System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) +690429
       System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) +327
       EuroFer.WSref.WebAppUtils.GetItemPrice(String itemCode, String customerCode, Int32 itemQuant) +146
       EuroFer.InsertOrder.btn_searchItem_Click(Object sender, EventArgs e) +591
       System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +153
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3804
    


    Is this caused by some autentication problems ? Maybe my service is trying to connect with a different user.... is it something i should fix in my code or something i should change in sql server settings ? 

  • Verified answer
    Suresh Kulla Profile Picture
    50,243 Super User 2025 Season 2 on at

    Make sure the Service user who is running the NAV Services/Web Service has proper permissions on the SQL Server for that database.

  • cuge Profile Picture
    on at

    Thankyou all for your suggestions that helped me to nail down the problem, I managed to make it work, the actual problem was that (in IIS) my application Pool  was using default identity 'ApplicationPoolIdentity' which didn't have proper rights for sql server, so i changed that identity with our admin user and this made the trick.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans