我正在使用WCF代理生成代码来解析WSDL文件 . 在指定为相对路径的WSDL架构位置中,我在同一文件夹中托管了WSDL和XSD文件,并在默认网站下的IIS中进行了配置 . 但是代码会抛出错误 .

The document was understood, but it could not be processed.
  - The WSDL document contains links that could not be resolved.
  - There was an error downloading 'file:///C:/Windows/TEMP/UserService.xsd'.
  - Could not find file 'C:\Windows\TEMP\UserService.xsd'.
  - Could not find file 'C:\Windows\TEMP\UserService.xsd'.
  - Could not find file 'C:\Windows\TEMP\UserService.xsd'.

WSDL的一部分如下所示

在WSDL文件中,它使用相对位置引用外部UserService.xsd:

<xsd:import namespace="http://document.webservice.business.cav" schemaLocation="UsweService.xsd">

但是,即使XSD文件与WSDL文件位于同一位置,它也不会解析WSDL文件 .

如果我修改schemaLocation没有相对路径,我可以生成代理DLL .

代码片段

//如果通过网络访问 Contract ,首先下载 Contract . DownloadContract(选项);

// Try to run RPC2DocumentLiteral converter.
            TryTranslateRpc2DocumentLiteral(options);
            MetadataSet metadataSet = new MetadataSet();
            XmlDocument doc = new XmlDocument();
            doc.LoadXml(options.MetadataLocation);
            MetadataSection ms = new MetadataSection(null, null, doc);
            metadataSet.MetadataSections.Add(ms);
            ResolveImports(options, metadataSet);
        // Resolve metadata using a DiscoveryClientProtocol.
        DiscoveryClientProtocol dcp = new DiscoveryClientProtocol();
        try
        {
            dcp.Credentials = options.Credentials;
            dcp.AllowAutoRedirect = true;
            dcp.DiscoverAny(options.MetadataLocation);   Code failing with above error
            dcp.ResolveAll();
           ----

有人可以帮我这方面 .

拉玛