当前位置:编程学习 > C#/ASP.NET >>

调用webservice时用代码进行配置

请问各位,我想调用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信息
引用 4 楼  的回复:
先写个类?类里写一个连接字符串?
然后再调用这个类的连接字符串?
这样可以吗?
--------------------编程问答-------------------- 请大家帮帮忙 --------------------编程问答-------------------- 没有遇到这种情况
也不太明吧楼主这样做的用意
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,