Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/288.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 无法创建WCF客户端_C#_Wcf_Service_Client_App Config - Fatal编程技术网

C# 无法创建WCF客户端

C# 无法创建WCF客户端,c#,wcf,service,client,app-config,C#,Wcf,Service,Client,App Config,我有WCF服务这是我的app.config <?xml version="1.0" encoding="utf-8" ?> <configuration> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> </startup> <system.serviceModel>

我有WCF服务这是我的app.config

    <?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
    </startup>
    <system.serviceModel>
        <behaviors>
            <serviceBehaviors>
                <behavior name="">
                    <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
                    <serviceDebug includeExceptionDetailInFaults="false" />
                </behavior>
            </serviceBehaviors>
        </behaviors>
        <services>
            <service name="PassAccessSystem.DBService.DBHostService">
                <endpoint address="" binding="basicHttpBinding" contract="PassAccessSystem.DBService.IDBHostService">
                    <identity>
                        <dns value="localhost" />
                    </identity>
                </endpoint>
                <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
                <host>
                    <baseAddresses>
                        <add baseAddress="http://localhost:8733/Design_Time_Addresses/PassAccessSystem/DBHostService/" />
                    </baseAddresses>
                </host>
            </service>
        </services>
    </system.serviceModel>
</configuration>


我需要更多的信息。如果这是客户端app.config,则需要在system.serviceModel/client下添加。无法使用app.config中的服务器端设置

正如您所说,您正在使用添加服务引用,那么我希望您已经提交了结果,这不是我在您包含的配置文件中看到的结果

如果您在自己的代码中自托管wcf服务,那么我倾向于不在调试模式下运行主机,然后添加服务引用,因为现在主机正在运行


事实上,如果您自己托管它并从富客户端使用它,那么您可以完全跳过所有配置,直接在ChannelFactory上使用接口-但这是另一回事…

您应该首先验证您的服务没有任何问题,并且它已启动并运行。如果服务也在WCF中,那么您只需在浏览器中键入完整的地址即可浏览服务,您应该能够看到服务页面。一旦您可以浏览,您就可以使用add reference或svcuti命令创建客户端/代理。

t这不是web应用程序,我可以添加什么web服务?这是app.config吗?这是service side.config文件,我尝试添加引用,当服务在调试模式而不是deb模式下运行时,在“添加服务”窗口中找不到服务,您使用什么url查找服务或我显示我所做的我创建了一个程序,带有一个表单项目,eiher,添加WCF服务,(类,接口),但现在当我在任务管理器中运行程序时,我找不到我的服务,我现在不知道有什么问题
An error occured while attempting to find services
cannot download metadata