高手赐教:怎么实现不同客户端访问WCF服务器

wxm245 2007-07-25 03:15:24
是不是象webservice一样需要将wcf放在iis里啊?
多谢指教!
...全文
409 15 打赏 收藏 转发到动态 举报
写回复
用AI写文章
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
pengtyf 2008-06-17
  • 打赏
  • 举报
回复
搞定了没有呀,没消息了呀?
sgp1201 2007-12-26
  • 打赏
  • 举报
回复
LZ搞定了没有!
wxm245 2007-07-25
  • 打赏
  • 举报
回复
你有例子么? 有的话发个给我吧 这样问问不出问题来!
台麻烦了 加我msn吧 wxm245@hotmail.com
wxm245 2007-07-25
  • 打赏
  • 举报
回复
还是不行。。
guoweijun394 2007-07-25
  • 打赏
  • 举报
回复
之后服务端重编译下,客户那边重引用下
guoweijun394 2007-07-25
  • 打赏
  • 举报
回复
你把<identity>
<userPrincipalName value="SK\Administrator" />
</identity>去掉
服务端改成这样 试试
<wsHttpBinding>
<binding name="WSHttpBinding_IMessageService" closeTimeout="00:10:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="52428800" maxReceivedMessageSize="10240000" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="81920000" maxArrayLength="163840000" maxBytesPerRead="40960000" maxNameTableCharCount="163840000" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</wsHttpBinding>
wxm245 2007-07-25
  • 打赏
  • 举报
回复
我把<identity>
<userPrincipalName value="SK\Administrator" />
</identity>去了 还是报一样的错误!


如果在wsHttpBinding 的security节点配置的话怎么配置 ?
guoweijun394 2007-07-25
  • 打赏
  • 举报
回复
把客户端和服务端的 wsHttpBinding 的改下 <security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None" realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" establishSecurityContext="true" />
</security>
guoweijun394 2007-07-25
  • 打赏
  • 举报
回复
<identity>
<userPrincipalName value="SK\Administrator" />
</identity> 这句你在服务端有对应的identity吗?

如果没有的加上对应的identity,或者都去掉 ,要加的话在服务端 wsHttpBinding 的security节点配置下
wxm245 2007-07-25
  • 打赏
  • 举报
回复
<client>
<endpoint address="http://localhost:8001/servicemodelsamples/service"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IPurchaseRequestService"
contract="OrderApplication.WCFService.IPurchaseRequestService"
name="WSHttpBinding_IPurchaseRequestService">
<identity>
<userPrincipalName value="SK\Administrator" />
</identity>
</endpoint>
</client>

这是客户端的配置文件 我把address="http://localhost:8001/servicemodelsamples/service"
中的localhost换成了我的IP地址在别人机器上 !

通过跟程序在调用WCF中的方法时报错:服务没有认证
guoweijun394 2007-07-25
  • 打赏
  • 举报
回复
实例化本地代理时 报的什么错误?你把配置文件贴出看下
wxm245 2007-07-25
  • 打赏
  • 举报
回复
服务器在我机器上启动着呢 主要是别的机器上的客户端连我机器上的WCF服务就连不上
网页中可以直接访问服务器中发布的url 请问这是怎么回事!

guoweijun394 2007-07-25
  • 打赏
  • 举报
回复
你的服务需要一个托管进程来执行,就行webservice是在IIS中托管。
而wcf和remoting 可以自己 做程序托管,(在iis中也可以托管和webservice一样)。
具体的实现细节你到网上查查remoting 的或者wcf有个例子 ..\WinFXSamples\WCFSamples\TechnologySamples\Basic\Service\Hosting\SelfHost,你可以看下,目的就是管理配置文件。服务端有一个配置文件,你可以把这个配置文件分成2个去管理,WCF 不就是ABC吗(address,bingding,contract),都是在配置文件中配置的,你管理下这个文件就可。
wxm245 2007-07-25
  • 打赏
  • 举报
回复
什么意思 小弟不才 听不太明白
希望讲详细点 或者举个例子

我把winform程序的exe 和 app.config文件
拉到别人机器上 然后在app.config中配置一下 有点问题

报错说是没有认证!
guoweijun394 2007-07-25
  • 打赏
  • 举报
回复
wcf服务宿主管理可以让IIS托管,也可以是自己开发的winform程序去托管。
和remoting一样。建议自己开发winform程序去托管,就是管理服务端的配置文件,可以再做一个单独的服务配置文件。

110,539

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧