我有一个已发布的 WCF 服务正确运行并通过拉起 wsdl 进行验证?屏幕。
但是,当我尝试使用来自单独网站的代码访问任何方法时,我收到以下错误:
服务“wcfServiceFromCaps.AgentWebAppServiceClient”的应用程序(非基础设施)端点为零。这可能是因为找不到您的应用程序的配置文件
[ServiceContract]
interface IAgentWebAppService
{
[OperationContract]
[FaultContract(typeof(ServiceData))]
void DoWork();
[OperationContract]
[FaultContract(typeof(ServiceData))]
String GetAgentPicURLUsingStation(string station);
}
客户端 WebConfig
<configuration>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IAgentWebAppService" 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="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://myfulladdresshere:87/AgentWebAppService.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IAgentWebAppService"
contract="IAgentWebAppService" name="WSHttpBinding_IAgentWebAppService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>
客户 CS
AgentWebAppServiceClient newWcf = new AgentWebAppServiceClient();
try
{
string newstring = newWcf.GetAgentPicURLUsingStation(this.Phone);
newpicurl = newstring;
}
catch (FaultException<wcfServiceFromCaps.ServiceData> Fex)
{
....
}
我错过了什么?
更新!* *
我通过清理所有内容并从头开始重新创建来解决它。现在我收到以下消息:
无法打开登录请求的数据库“dbname”。登录失败。用户“Servername$”登录失败