不能添加wcf服务

风一样的大叔 2012-08-28 10:15:01
我在网上找到个demo,里面添加服务引用时出现下面的错误
[img=http://hiphotos.baidu.com/qiujialong_jsj/pic/item/f8beabae2edda3cc3441fabe01e93901203f9214.jpg]a[/img]
[img=http://hiphotos.baidu.com/qiujialong_jsj/pic/item/f5ab0ef6905298227c897b5dd7ca7bcb0b46d47b.jpg]s[/img]
[img=http://hiphotos.baidu.com/qiujialong_jsj/pic/item/1ec3d61273f08202e537d3a14bfbfbedaa641b14.jpg]as[/img]
...全文
176 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
宝_爸 2012-09-04
  • 打赏
  • 举报
回复
用管理员身份运行host WCF的程序.
糊涂浩浩 2012-09-04
  • 打赏
  • 举报
回复
应该是你的元数据没有完全发布出来导致的错误,检查一下你的元数据。
风一样的大叔 2012-08-29
  • 打赏
  • 举报
回复
[img=http://img.my.csdn.net/uploads/201208/29/1346208813_3952.jpg.thumb.jpg]a[/img]

[img=http://img.my.csdn.net/uploads/201208/29/1346208874_9350.jpg]c[/img]

[img=http://img.my.csdn.net/uploads/201208/29/1346208822_4067.jpg]d[/img]
liuta8506 2012-08-29
  • 打赏
  • 举报
回复
还是没有图片
风一样的大叔 2012-08-29
  • 打赏
  • 举报
回复
webconfig中
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IUser" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false"
transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="524288" messageEncoding="Text"
textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="16384" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="None">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://10.10.1.68:81/CHINAZTT.ZTAM.BLL.User.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IUser"
contract="UserBLL.IUser" name="WSHttpBinding_IUser">
<identity>
<dns value="localhost" />
</identity>
</endpoint>

</client>
<client>
<endpoint address="http://localhost:8732/Report/mex"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IReport"
contract="ReportBLL.IReport" name="WSHttpBinding_IReport">
<identity>
<dns value="localhost" />
</identity>
</endpoint>

</client>
</system.serviceModel>
</configuration>


另一个app.config中
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="SaveFilePath" value="D:\PIMS"/>
<add key="FTPPath" value="ftp://10.10.1.68"/>
</appSettings>
<system.web>
<compilation debug="true"/>
</system.web>
<!-- 部署服务库项目时,必须将配置文件的内容添加到
主机的 app.config 文件中。System.Configuration 不支持库的配置文件。-->
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="NoneSecurity" useDefaultWebProxy="false">
<security mode="None"/>
</binding>
</wsHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="CHINAZTT.ZTAM.BLL.ZTAMBehavior"
name="CHINAZTT.ZTAM.BLL.User">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="NoneSecurity"
contract="CHINAZTT.ZTAM.BLL.IUser">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8731/User/" />
</baseAddresses>
</host>
</service>
<service
behaviorConfiguration="CHINAZTT.ZTAM.BLL.ZTAMBehavior"
name="CHINAZTT.ZTAM.BLL.REP.Report">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="NoneSecurity"
contract="CHINAZTT.ZTAM.BLL.REP.IReport">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8732/Report/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="CHINAZTT.ZTAM.BLL.ZTAMBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>
风一样的大叔 2012-08-29
  • 打赏
  • 举报
回复
报“从次地址下载元数据出错,请确认您输入的有效地址”
风一样的大叔 2012-08-29
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 的回复:]

图挂成大象了 你可能添加引用添加错了地方,不是在引用里面添加的
是在Service References 这个文件夹里面添加的
必须先在项目里面右键 添加服务引用
[/Quote]就是这么添加的
宝_爸 2012-08-29
  • 打赏
  • 举报
回复
看错误是service没有部署好。在浏览器中访问service地址试一试。
杰拉尔 2012-08-29
  • 打赏
  • 举报
回复
图挂成大象了 你可能添加引用添加错了地方,不是在引用里面添加的
是在Service References 这个文件夹里面添加的
必须先在项目里面右键 添加服务引用
风一样的大叔 2012-08-28
  • 打赏
  • 举报
回复
http://hiphotos.baidu.com/qiujialong_jsj/pic/item/f8beabae2edda3cc3441fabe01e93901203f9214.jpg


http://hiphotos.baidu.com/qiujialong_jsj/pic/item/f5ab0ef6905298227c897b5dd7ca7bcb0b46d47b.jpg

http://hiphotos.baidu.com/qiujialong_jsj/pic/item/1ec3d61273f08202e537d3a14bfbfbedaa641b14.jpg

12,162

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 Web Services
社区管理员
  • Web Services社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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