高手赐教:怎么实现不同客户端访问WCF服务器 是不是象webservice一样需要将wcf放在iis里啊?多谢指教! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 wcf服务宿主管理可以让IIS托管,也可以是自己开发的winform程序去托管。和remoting一样。建议自己开发winform程序去托管,就是管理服务端的配置文件,可以再做一个单独的服务配置文件。 什么意思 小弟不才 听不太明白希望讲详细点 或者举个例子我把winform程序的exe 和 app.config文件 拉到别人机器上 然后在app.config中配置一下 有点问题报错说是没有认证! 你的服务需要一个托管进程来执行,就行webservice是在IIS中托管。而wcf和remoting 可以自己 做程序托管,(在iis中也可以托管和webservice一样)。具体的实现细节你到网上查查remoting 的或者wcf有个例子 ..\WinFXSamples\WCFSamples\TechnologySamples\Basic\Service\Hosting\SelfHost,你可以看下,目的就是管理配置文件。服务端有一个配置文件,你可以把这个配置文件分成2个去管理,WCF 不就是ABC吗(address,bingding,contract),都是在配置文件中配置的,你管理下这个文件就可。 <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中的方法时报错:服务没有认证 <identity><userPrincipalName value="SK\Administrator" /></identity> 这句你在服务端有对应的identity吗?如果没有的加上对应的identity,或者都去掉 ,要加的话在服务端 wsHttpBinding 的security节点配置下 把客户端和服务端的 wsHttpBinding 的改下 <security mode="Message"> <transport clientCredentialType="Windows" proxyCredentialType="None" realm="" /> <message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" establishSecurityContext="true" /> </security> 我把<identity><userPrincipalName value="SK\Administrator" /></identity>去了 还是报一样的错误! 如果在wsHttpBinding 的security节点配置的话怎么配置 ? 你把<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> 关闭SqlDataReader 后还能否读取数据 用C#实现求点坐标,并画矩形,如下:谢谢 无主键 数据库更新问题 是否有办法防止被探测到使用了代理? 关于ListView 控件数据绑定的疑问 我这一段代码错在哪里 100分求教一些简单的问题,类似QQ界面的 经典问题之c#开发单机版的问题?? 文本框输入的问题。 基于C#调用的百度地图如何把地图上两点按照马路走向相连? 多线程lock的问题,急~~~求救~~~ 失业两个月为纪念这个刻骨铭心的日子散分
和remoting一样。建议自己开发winform程序去托管,就是管理服务端的配置文件,可以再做一个单独的服务配置文件。
希望讲详细点 或者举个例子我把winform程序的exe 和 app.config文件
拉到别人机器上 然后在app.config中配置一下 有点问题报错说是没有认证!
而wcf和remoting 可以自己 做程序托管,(在iis中也可以托管和webservice一样)。
具体的实现细节你到网上查查remoting 的或者wcf有个例子 ..\WinFXSamples\WCFSamples\TechnologySamples\Basic\Service\Hosting\SelfHost,你可以看下,目的就是管理配置文件。服务端有一个配置文件,你可以把这个配置文件分成2个去管理,WCF 不就是ABC吗(address,bingding,contract),都是在配置文件中配置的,你管理下这个文件就可。
<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中的方法时报错:服务没有认证
<userPrincipalName value="SK\Administrator" />
</identity> 这句你在服务端有对应的identity吗?如果没有的加上对应的identity,或者都去掉 ,要加的话在服务端 wsHttpBinding 的security节点配置下
<transport clientCredentialType="Windows" proxyCredentialType="None" realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" establishSecurityContext="true" />
</security>
<userPrincipalName value="SK\Administrator" />
</identity>去了 还是报一样的错误!
如果在wsHttpBinding 的security节点配置的话怎么配置 ?
<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>