我创建了一个Web服务并将其发布到IIS。我想从我的mvc应用程序中使用此Web服务。我试图从控制器中调用它,但是我为我的mvc项目添加了一个服务引用,但是我无法创建一个service1对象来调用Web服务。
我是Web服务和MVC的新手。你能看到配置文件有什么问题吗?
以下是Web服务的配置文件:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="NoSecurityPlusRM">
<reliableSession enabled="true" />
<security mode="None" />
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint binding="wsHttpBinding" bindingConfiguration="" contract="HelloWorldPracticeService.IService1"
name="Service1Endpoint" />
</client>
<services>
<service name="HelloWorldPracticeService.Service1">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="NoSecurityPlusRM"
contract="HelloWorldPracticeService.IService1" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
这是客户端中的配置文件
<system.serviceModel>
<client>
<endpoint name="Service1Endpoint"
address="http://c-3po.ccf.ca.gov/HelloWorldPracticeService/Service1"
binding="wsHttpBinding"
contract="IService1"></endpoint>
</client>
<bindings>
<basicHttpBinding>
</basicHttpBinding>
<wsHttpBinding>
</wsHttpBinding>
</bindings>