你是在类库项目里引用了WebService了吧?然后Web层调用类库?要在web层的配置文件中添加类库的App.Config里引用信息的
解决方案 »
- 急~如何防止刷新后重复提交!
- 关于URL传参的问题_f
- Global.asax问题
- 关于gridview的一个比较头疼的操作
- Help!!!英文字符串大小写格式化!英文名第一个字符大写,姓第一个字符大写:如:david charly格式化后为:David Charly
- 为什么在框架的左侧显示不出treeview结构,今晚就用,超急!!!!!!!!!!!!!!
- 数据更新时出现 未将对象引用设置到对象的实例
- 如何在web页上使用有界面的atl控件?请指教!
- 如何在T型框架的任何一个页面内让主框架更新。
- .net对上传文件大小有限制?
- mvc一个页面上有两个功能
- 江湖告急:girdview1中绑定多表,对gridview分页,实现上一页,下一页,跳转到指某一页,点击表头,可以实现对表的排序。
<bindings>
<basicHttpBinding>
<binding name="WSWorkManagerSoap" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://172.16.100.168:8099/WSWorkManager.asmx" binding="basicHttpBinding" bindingConfiguration="WSWorkManagerSoap" contract="ws.WSWorkManagerSoap" name="WSWorkManagerSoap" />
</client>
</system.serviceModel>
以下是我的配置文件:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="MobileCodeWSSoap" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
<customBinding>
<binding name="MobileCodeWSSoap12">
<textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16"
messageVersion="Soap12" writeEncoding="utf-8">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</textMessageEncoding>
<httpTransport manualAddressing="false" maxBufferPoolSize="524288"
maxReceivedMessageSize="65536" allowCookies="false" authenticationScheme="Anonymous"
bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
keepAliveEnabled="true" maxBufferSize="65536" proxyAuthenticationScheme="Anonymous"
realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false"
useDefaultWebProxy="true" />
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="http://webservice.webxml.com.cn/WebServices/MobileCodeWS.asmx"
binding="basicHttpBinding" bindingConfiguration="MobileCodeWSSoap"
contract="ServiceReference1.MobileCodeWSSoap" name="MobileCodeWSSoap" />
<endpoint address="http://webservice.webxml.com.cn/WebServices/MobileCodeWS.asmx"
binding="customBinding" bindingConfiguration="MobileCodeWSSoap12"
contract="ServiceReference1.MobileCodeWSSoap" name="MobileCodeWSSoap12" />
</client>
</system.serviceModel>
</configuration>
第一:文件名一定要是App.config;第二:endpoint的name属性值,在代码实例化时要一致。
然后:
可能你的app.config中有类似这样的情况
<client>
<endpoint address="http://localhost/Service1.svc" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IPersonService" contract="IPersonService"
name="BasicHttpBinding_IPersonService" />
<endpoint address="http://sh-maweina.snda.root.corp/Service1.svc/basic"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IPersonService"
contract="IPersonService" name="BasicHttpBinding_IPersonService1" />
</client>
就是说,有多个终结点(多个endpoint),所以你必须要指定一个,你可以把代码写成这样:
PersonServiceClient client = new PersonServiceClient("BasicHttpBinding_IPersonService");
就行了。
这些在我本地调试通过。
不过我已经解决了
是这样的
1 首先配置web.config
<bindings>
<basicHttpBinding>
--这个节点中,加入就是这一段
<binding name="APISoapBinding" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
--这个节点中,加入就是这一段
</basicHttpBinding>
</bindings>然后<client>
--这个节点中,加入就是这一段
<endpoint address="http://mail.geely.com/apiws/services/API"
binding="basicHttpBinding" bindingConfiguration="APISoapBinding"
contract="CoremailXTAPI.API" name="APIPort" />
--这个节点中,加入就是这一段
</client>当两端 配置加好后,实例化对象的时候,要这样
//APIPort这个名字就是对应的endpoint 节点中的 name="APIPort"
APIClient API=new APIClient("APIPort")这样就完成了~当然记得把web里的bin下的dll更新一下(这里不会多出dll,还是未添加web引用钱的那些dll)
你说的是对的,正确答案!