我使用webHttpBinding创建了一个新的IIS主机WCF服务,该webHttpBinding当前在我的开发机器上的IIS Express上运行,当我尝试"添加服务引用"时,服务正确构建并且Reference.cs文件看起来很好但是web .config或app.config文件未更新.
没有收到警告或错误消息.
服务和客户端都以.Net 4.5为目标.
服务配置
<system.serviceModel>
<bindings>
<webHttpBinding>
<binding name="webInteropSecureBinding" allowCookies="false" maxBufferPoolSize="2097152" maxBufferSize="2097152" maxReceivedMessageSize="2097152">
<security mode="Transport" />
</binding>
</webHttpBinding>
</bindings>
<services>
<service name="PsmDataProvider.PsmProvider" behaviorConfiguration="SecureRest">
<clear />
<endpoint address="" binding="webHttpBinding" bindingConfiguration="webInteropSecureBinding" name="PsmProvider" contract="PsmDataProvider.IPsmProvider" listenUriMode="Explicit" behaviorConfiguration="webHttpBehavior" />
<endpoint address="mex" binding="mexHttpsBinding" name="mex" contract="IMetadataExchange" listenUriMode="Explicit" />
<host>
<baseAddresses>
<add baseAddress="https://localhost:44300/PsmProvider/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="SecureRest">
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="webHttpBehavior">
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" …Run Code Online (Sandbox Code Playgroud) 不生成app.config.在我的团队中有一个人拥有Visual Studio 2008,他创建了一个Web服务.
然后就是我,将这个web服务添加到控制台项目中.
添加服务引用没有问题,但没有生成有效的app.config.它只是空的
<configuration>
</configuration>
Run Code Online (Sandbox Code Playgroud)
当我在我的服务引用中禁用"重用类型"时它可以工作,但后来我得到了一个模棱两可的错误.
这是一个错误吗?
我发现Visual Studio在"添加服务引用"这个时没有生成app.config内容,但是那里没有解决方案,所以我想我再次遇到问题了.
谢谢