Asp.net mvc WCF服务不可用';t生成web配置

Asp.net mvc WCF服务不可用';t生成web配置,asp.net-mvc,wcf,asp.net-mvc-4,web-config,console-application,Asp.net Mvc,Wcf,Asp.net Mvc 4,Web Config,Console Application,我有一个简单的WCF服务,我将尝试为我的控制台应用程序添加一个服务引用,它工作良好,并自动生成web配置配置 <system.serviceModel> <bindings> <basicHttpBinding> <binding name="BasicHttpBinding_IService1" /> </basicHttpBinding>

我有一个简单的WCF服务,我将尝试为我的控制台应用程序添加一个服务引用,它工作良好,并自动生成web配置配置

<system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="BasicHttpBinding_IService1" />
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://localhost:50765/Service1.svc" binding="basicHttpBinding"
                bindingConfiguration="BasicHttpBinding_IService1" contract="MyFirstService.IService1"
                name="BasicHttpBinding_IService1" />
        </client>
    </system.serviceModel>

在同一个服务中,我尝试为我的MVC项目添加一个服务引用。服务引用已成功添加,但未在web配置中生成。
如何解决此问题?

可能是Visual Studio中的一些错误/小故障。您可以始终在命令行上手动使用该工具,它将生成所有必要的内容:

svcutil.exe http://example.com/yourservicemetadata

是否在添加引用时给出了错误?laso请描述您在MVC项目中调用服务时遇到的错误?我没有任何错误。您是否可以在MVC应用程序中创建代理客户端?您是否可以解释有关svcutil.exe的更多信息?您需要什么进一步的解释?启动Visual Studio命令提示符窗口并键入
svcutil.exehttp://address_of_your_wcf_service
它将生成一个包含客户端代理类的
.cs
文件和一个
App.config
文件,其中包含需要添加到配置文件中的必要部分。回答得很好。您能否通过MSDN链接来改进它,了解如何使用生成的.cs?