我在经典ASP调用WCF服务中的方法时遇到问题。下面是服务和配置的代码:从经典ASP呼叫WCF服务
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_PdfGenerator"
maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647"
maxBufferPoolSize="2147483647"
transferMode="Buffered">
<readerQuotas
maxArrayLength="2147483647"
maxStringContentLength="2147483647"
maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647"
maxDepth="32" />
</binding>
</basicHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="serviceBehavior"
name="Plumtree.dartKW.PdfGenerator.Web.PdfGeneratorService">
<endpoint binding="basicHttpBinding"
bindingName="BasicHttpBinding_PdfGenerator"
contract="Plumtree.dartKW.PdfGenerator.Web.IPdfGeneratorService" />
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="serviceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
我在WCF测试客户端测试上述方法
服务
[ServiceContract(Namespace = "http://Plumtree.dartKW.PdfGenerator.Web")]
public interface IPdfGeneratorService
{
[OperationContract]
String GeneratePdf(String xml);
}
public class PdfGeneratorService : IPdfGeneratorService
{
#region IPdfGeneratorService Members
public String GeneratePdf(String xml)
{
return "hello";
}
#endregion
}
配置和正常工作。下面是从我的ASP页面的代码:
mexMonikerString = "service:mexAddress='http://localhost:51997/PdfGeneratorService.svc/mex'"
mexMonikerString = mexMonikerString + ", address='http://localhost:51997/PdfGeneratorService.svc'"
mexMonikerString = mexMonikerString + ", binding=basicHttpBinding"
mexMonikerString = mexMonikerString + ", bindingNamespace='http://tempuri.org/'"
mexMonikerString = mexMonikerString + ", contract=IPdfGeneratorService"
mexMonikerString = mexMonikerString + ", contractNamespace='http://Plumtree.dartKW.PdfGenerator.Web'"
dim service
service = GetObject(mexMonikerString)
每当我试试这个,我得到了以下错误:
System.ServiceModel error '800401e4'
The contract does not have an endpoint supporting the binding specified.
我试过在绰号传递绑定配置名称BasicHttpBinding_PdfGenerator
,而不是basicHttpBinding
但我犯了同样的错误。我在网上找不到任何其他这种错误的例子。
任何帮助,将不胜感激
感谢您的回复。根据无数的在线演示,我读过我的原代码应该工作。无论是服务的配置还是我正在构建的绰号,都有问题。有很多人在做我正在做的事情的例子,不幸的是,似乎没有人遇到与我一样的错误!非常沮丧 –
理解..我想如果你不能让你的ASP版本工作,你可以试试我在做什么。它很容易插入任何HTML/ASP类型构造。 – Brian