关于svcutil.exe生成的代理和配置
本人谢了一个WCF服务类库,然后建了一个WCF发布站,配置完以后运行svc文件,显示已创建服务。
若要测试此服务,需要创建一个客户端,并将其用于调用该服务。可以使用下列语法,从命令行中使用 svcutil.exe 工具来进行此操作:
svcutil.exe http://localhost:8119/WCFWEB/Service.svc?wsdl
于是我通过svcutil.exe生成了代理类和配置文件,但是考到WEB站点下面后引用不到生成的对应的client代理,有哪位大神碰到过此类问题啊,求解
附代理类配置
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService" 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>
<wsHttpBinding>
<binding name="MetadataExchangeHttpBinding_IService" 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="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" 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://172.16.19.33:8096/Service.svc" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IService" contract="IService"
name="BasicHttpBinding_IService" />
<endpoint address="http://172.16.19.33:8096/Service.svc/mex"
binding="wsHttpBinding" bindingConfiguration="MetadataExchangeHttpBinding_IService"
contract="IService" name="MetadataExchangeHttpBinding_IService" />
</client>
</system.serviceModel>
</configuration>
以下是WCF站点配置
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<services>
<service behaviorConfiguration="WEBWCFSERVICE" name="WCFSERVICE.PersonService">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration=""
contract="WCFSERVICE.IService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" bindingConfiguration=""
contract="WCFSERVICE.IService" />
<host>
<baseAddresses>
<add baseAddress="http://172.16.19.33:8096/Service.svc" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="WEBWCFSERVICE">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
最后是类库配置
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<compilation debug="true" />
</system.web>
<!-- 部署服务库项目时,必须将配置文件的内容添加到
主机的 app.config 文件中。System.Configuration 不支持库的配置文件。-->
<system.serviceModel>
<services>
<service behaviorConfiguration="WCF.PersonService" name="WCFSERVICE.PersonService">
<endpoint address="" binding="wsHttpBinding" contract="WCFSERVICE.IService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="WCFSERVICE.IService" />
<host>
<baseAddresses>
<add baseAddress="http://172.16.19.33:8096/Service.svc" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="WCF.PersonService">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
--------------------编程问答-------------------- 没大神么。。。 --------------------编程问答-------------------- 自己顶一下。。。 --------------------编程问答-------------------- 大神在哪里。。、都一周了。。。还没人回我 --------------------编程问答-------------------- csdn没落了?
补充:.NET技术 , ASP.NET