You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

WCF Web Service本地运行正常,指定IP访问失败求助

Troubleshooting WCF Service Access via IP Address

Hey there! I’ve dealt with this exact WCF access issue a few times before, so let’s walk through the most likely fixes to get your service working on 192.168.1.103:80:

  • Fix your WCF binding configuration
    Double-check your web.config or app.config—the service might be hardlocked to localhost. Look for the <system.serviceModel> section:

    • For your endpoint, use a wildcard (*) or the specific IP instead of localhost in the address, like:
      <endpoint address="http://*:80/YourService" binding="basicHttpBinding" contract="IYourServiceContract" />
      
    • Add or ensure the <serviceHostingEnvironment> node has multipleSiteBindingsEnabled="true" to support multiple address bindings:
      <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
      
  • Grant port listening permissions
    Port 80 is a privileged port, so your service process might not have permission to listen on it.

    1. Open Command Prompt as Administrator.
    2. Run netsh http show urlacl to check if http://192.168.1.103:80/ has an entry.
    3. If not, add the permission with:
      netsh http add urlacl url=http://192.168.1.103:80/ user=YourWindowsUsername
      

    Replace YourWindowsUsername with your actual login account for better security than using Everyone.

  • Adjust firewall settings
    Your local firewall is probably blocking incoming traffic on port 80:

    • Open Windows Defender Firewall > Advanced Settings > Inbound Rules.
    • Create a new rule to allow TCP traffic on port 80, targeting either your WCF service executable or all programs.
    • If you’re accessing from another device on the network, make sure your router firewall isn’t blocking port 80 either.
  • Verify your machine’s IP and network adapter

    • Run ipconfig in Command Prompt to confirm your machine is actually using 192.168.1.103 (sometimes IPs change if DHCP is enabled).
    • If you have multiple network adapters (wired + wireless), ensure the service is binding to the correct one—using * in the endpoint address will bind to all adapters, which is usually safer.
  • Test locally first

    • Try accessing http://192.168.1.103:80 from the same machine running the service. If this fails, the issue is local (config/permissions). If it works, the problem is with network connectivity between devices.
    • Use Test-NetConnection 192.168.1.103 -Port 80 in PowerShell to quickly check if the port is reachable.
  • Check hosting setup

    • If self-hosting: Make sure your service startup code explicitly binds to the IP/port, not just localhost. Example:
      var serviceHost = new ServiceHost(typeof(YourService));
      var binding = new BasicHttpBinding();
      serviceHost.AddServiceEndpoint(typeof(IYourServiceContract), binding, "http://192.168.1.103:80/YourService");
      serviceHost.Open();
      
    • If IIS-hosted: Go to your website’s Bindings in IIS Manager, and add a new binding for 192.168.1.103 on port 80—don’t just rely on the localhost:55077 binding.

Give these steps a shot, and let me know if you hit any snags!

内容的提问来源于stack exchange,提问作者Sevket

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 09:21:42