请问各位,我想调用webservice ,但是因为某种原因,我不能使用app.config配置WebService信息,也就是说我要在调用前写代码替换如下配置:
<system.serviceModel> <bindings> <basicHttpBinding> <binding name="IUserInfoServiceHttpBinding" 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=""> <extendedProtectionPolicy policyEnforcement="Never" /> </transport> <message clientCredentialType="UserName" algorithmSuite="Default" /> </security> </binding> </basicHttpBinding> </bindings> <client> <endpoint address="http://192.168.1.118:7001/arsipWebService/service/IUserInfoService" binding="basicHttpBinding" bindingConfiguration="IUserInfoServiceHttpBinding" contract="UserInfoService.IUserInfoServicePortType" name="IUserInfoServiceHttpPort" /> </client> </system.serviceModel>
请大家帮帮忙,谢谢了
如果你是通过服务引用生成的客户端的话,那么你查阅下客户端的构造函数,你可以使用其中的一个重载方法来在代码中传入这些参数。
弄个动态创建的webservice来操作,不过要写代码,可以上网查查