问题描述
你好,
我已经做了简单的WCF服务,该服务返回了硬编码的号码,现在到目前为止一切正常.
我发布了网站,然后通过IIS仍然可以正常运行
本地主机/网站名称/site.aspx< --------这有效
但是当我尝试Ipaddress/websitename/site.aspx时,它不会调用Wcf服务!
有任何建议吗?
Hello,
I have made simple WCF service that returns hard coded number,now everything works so far.
I published website then through IIS it still works
localhost/websitename/site.aspx <-------- This works
but when i tried Ipaddress/websitename/site.aspx It doesn''t call Wcf service !
Any suggestion ?
推荐答案
<system.serviceModel>
<client>
<endpoint name="DataService" address="net.tcp://localhost:34433/DataService" binding="netTcpBinding" bindingConfiguration="MyDataServiceBinding" contract="MyDataService" behaviorConfiguration="DataServiceBehavior" />
</client>
[更新] <client></client>
部分进入客户端应用程序的app.config文件-客户端最初如何找到服务器.
[更新2]
尝试打开 http://160.84.56.116/Website/Service1.svc [ ^ ]
如果这不起作用-您可能遇到服务器端问题.如果160.84.56.116是公用IP地址,则您确实存在服务器端问题,因为我无法连接到该地址上的任何内容.不ping并且不 http://160.84.56.116 [ ^ ]
最好的问候
Espen Harlinn
[Update]
the <client></client>
section goes into the app.config file of the client application - that''s how the client initially can locate the server.
[Update 2]
Try opening http://160.84.56.116/Website/Service1.svc[^] in your web browser
If this don''t work - you probably have a serverside problem. If 160.84.56.116 is a public IP address, you do have a server side problem, because I''m not able to connect to anything at that address. not ping and not http://160.84.56.116[^]
Best regards
Espen Harlinn
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService1" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<security mode="None" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://160.84.56.116/Website/Service1.svc" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IService1" contract="ServiceReference1.IService1"
name="BasicHttpBinding_IService1" />
</client>
</system.serviceModel>
</configuration>
这篇关于发布网站后WCF服务不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!