我在經典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