【发布时间】:2020-02-10 18:13:10
【问题描述】:
我有 WCF 服务,它使用 IP 在我的服务器机器上运行良好,它在客户端(android studio)上工作,但突然停止工作,我尝试了互联网上的所有解决方案,但似乎没有任何帮助,服务仍在工作服务器浏览器/邮递员。
如果需要,这是我的 web.config 文件:
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.7.2" />
<httpRuntime targetFramework="4.7.2"/>
</system.web>
<system.serviceModel>
<services>
<service name="WcfService.Service1" behaviorConfiguration="WCFService.Service1Behavior">
<!-- Service Endpoints -->
<endpoint address="" binding="webHttpBinding" behaviorConfiguration="myWeb" contract="WcfService.IService1">
<!--
Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.
-->
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="myWeb">
<webHttp/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="WCFService.Service1Behavior">
<!-- To avoid disclosing metadata information, set the value below to false before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpBinding" scheme="http" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true"/>
</system.webServer>
</configuration>
我的防火墙也被完全禁用。 当我从手机或其他电脑 ping 服务时,它会出现错误: 无法访问此站点。 Err_Address_Unreachable
【问题讨论】:
-
如果您说您无法访问它,“Service still.working on server”是什么意思?您尝试使用哪个设备?您尝试过哪个地址(本地主机)? “突然停止工作”是什么意思?
-
仍在服务器上工作意味着如果我在服务器的浏览器或 Postman 上尝试它工作正常。我试图在浏览器和客户端应用程序上从另一台电脑和三星移动设备(顺便说一句,它之前正在使用)对其进行 ping 操作。地址:192.168.100.110:80/WcfService/Service1.svc/getColors 突然停止工作意味着它早些时候在移动/客户端/其他浏览器上运行良好,现在不是。我没有对服务器进行任何更改。
-
检查防火墙是否在重新启动时重新启动,并检查您机器上的 antivir pgm
-
防火墙已关闭,我一直在疯狂地检查它,因为所有答案都是如此建议的。我的机器上也没有安装防病毒程序。
-
ip 正确吗?也许 DHCP 给你分配了另一个?两台电脑必须在同一个局域网上,同时检查另一台电脑的IP。
标签: c# android-studio wcf service