[英]invoke WCF service on other machines on the same network not working
I have a WCF Service running on my local machine 我在本地计算机上运行了WCF服务
Everything themes to be running okay 一切主题都运行正常
Question is 问题是
if i can Invoke this WCF
Service on my local machine browser why it is not available on other machines 如果我可以在我的本地计算机浏览器上调用此WCF
服务,为什么它在其他计算机上不可用
what i have tried : 我试过的:
localhost
: port
on the other machine i replaced the localhost with the ip of the machine where my WCF
service is running and it didn't work 我的服务地址是localhost
:另一台机器上的port
我用运行我的WCF
服务的机器的ip替换了本地主机,但是它没有工作 App.config
i changed the baseaddress
as you can see below from localhost
to the machine ip and it didn't work either 在我的App.config
我更改了baseaddress
,如下所示,从localhost
到机器ip,它也无法正常工作 getJson
and it worked on my local machine browser and not on any of the other machine it loads the whole page and gives me error on getJson
我创建了一个Web应用程序并使用getJson
调用我的服务,它在我的本地机器浏览器上运行,而不是在任何其他机器上它加载整个页面并在getJson
上给我错误 what i am missing here ??? 我在这里失踪了什么? i don't know 我不知道
IService1.cs IService1.cs
[OperationContract]
[WebGet(UriTemplate = "GetName/{name}",
ResponseFormat = WebMessageFormat.Json)]
List<Eval> GetName(string name);
App.config App.config中
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
<system.serviceModel>
<bindings>
<webHttpBinding>
<binding name="webHttpBindingWithJsonP" crossDomainScriptAccessEnabled="true"></binding>
</webHttpBinding>
</bindings>
<services>
<service name="WcfServiceLibrary1.Service1">
<host>
<baseAddresses>
<add baseAddress = "http://192.168.1.5:8733/Design_Time_Addresses/WcfServiceLibrary1/Service1/" />
</baseAddresses>
</host>
<endpoint address="" binding="webHttpBinding" bindingConfiguration="webHttpBindingWithJsonP" contract="WcfServiceLibrary1.IService1" behaviorConfiguration="web">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="web">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
WCF Test Client WCF测试客户端
Browser 浏览器
It might be that firewall is stopping service call. 可能是防火墙正在停止服务呼叫。 Open inbound connection on port 8733 on machine where WCF is hosted. 在托管WCF的计算机上的端口8733上打开入站连接。 In case of Windows, open the Windows Firewall with Advanced Security dialog box, in the left pane, click Inbound Rules, and then, in the right pane, click New Rule and select Port option. 如果是Windows,请打开“高级安全Windows防火墙”对话框,在左窗格中单击“入站规则”,然后在右窗格中单击“新建规则”并选择“端口”选项。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.