none
Cannot import wsdl:portType when a wcf service.svc is on IIS. RRS feed

  • Question

  • Warning	3	Custom tool warning: Cannot import wsdl:portType
    Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter
    Error: Schema with target namespace '' could not be found.
    XPath to Error Source: //wsdl:definitions[@targetNamespace='']/wsdl:portType[@name='Service']	D:\Websites\Dating\Service References\ServiceReference\Reference.svcmap	1	1	Dating
    

    I got this error when I put my wcf service on iis and try to reference it using VS.

    If I reference the service when it is holding in VS, there is no problem.

    You can see the service here: http://bernybon.no-ip.org/DatingUs/Service.svc

    Try to reference it, you will see.


    Bernard Lessard

    Wednesday, January 23, 2013 2:51 AM

Answers

All replies

  • Hi,

    Please try uncheck "Reuse types in referenced assemblies" when you add the service reference as suggested in below blog.

    http://www.marcusoft.net/2009/01/custom-tool-warning-cannot-import.html

    Best Regards.


    Haixia
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, January 24, 2013 3:55 AM
    Moderator
  • It is not working for me.

    Here what I get when I do that:


    Bernard Lessard

    Thursday, January 24, 2013 4:23 AM
  • Here what I have in my web.config file:

    <?xml version="1.0"?>
    
    <!--
      For more information on how to configure your ASP.NET application, please visit
      http://go.microsoft.com/fwlink/?LinkId=169433
      -->
    
    <configuration>
    
      <system.diagnostics>
        <sources>
          <source name="System.ServiceModel"
                  switchValue="Information, ActivityTracing"
                  propagateActivity="true">
            <listeners>
              <add name="traceListener"
                  type="System.Diagnostics.XmlWriterTraceListener"
                  initializeData="c:\trace.svclog"  />
            </listeners>
          </source>
        </sources>
      </system.diagnostics>
    
      <connectionStrings>
        <add name="DatabaseConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True"
          providerName="System.Data.SqlClient" />
        <add name="DatingConnectionString" connectionString="Data Source=DESKTOP-PC\DESKTOP;Initial Catalog=Dating;Persist Security Info=True;User ID=sa;Password=***********"
          providerName="System.Data.SqlClient" />
      </connectionStrings>
      <system.web>
        <compilation debug="true" targetFramework="4.0" />
      </system.web>
    
      <system.serviceModel>
        <behaviors>
          <serviceBehaviors>
            <behavior name="serviceBehavior">
              <serviceMetadata httpGetEnabled="true" />
              <dataContractSerializer maxItemsInObjectGraph="2147483647" />
              <serviceDebug includeExceptionDetailInFaults="true" />
            </behavior>
            <behavior name="">
              <serviceMetadata httpGetEnabled="true" />
              <serviceDebug includeExceptionDetailInFaults="false" />
            </behavior>
          </serviceBehaviors>
        </behaviors>
        <bindings>
          <basicHttpBinding>
            <binding name="streamForVideo" hostNameComparisonMode="StrongWildcard"
              maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
              transferMode="Streamed">
              <readerQuotas maxDepth="64" maxStringContentLength="2147483647"
                maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
              <security mode="None" />
            </binding>
          </basicHttpBinding>
          <customBinding>
            <binding name="Dating.Web.SessionService.customBinding0">
              <binaryMessageEncoding />
              <httpTransport />
            </binding>
          </customBinding>
        </bindings>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true"
          multipleSiteBindingsEnabled="true" />
        <services>
          <service behaviorConfiguration="serviceBehavior" name="Dating.Web.Service">
            <endpoint address="" binding="basicHttpBinding" bindingConfiguration="streamForVideo"
              contract="Dating.Web.Service" />
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
          </service>
          <service name="Dating.Web.SessionService">
            <endpoint address="" binding="customBinding" bindingConfiguration="Dating.Web.SessionService.customBinding0"
              contract="Dating.Web.SessionService" />
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
          </service>
        </services>
      </system.serviceModel>
    </configuration>
    


    Bernard Lessard

    Thursday, January 24, 2013 4:26 AM
  • Hi,

    Do you try delete the service reference, restart VS and adding the reference again?

    If it does not work. please check application pool identity user and grant it full access to c:\windows\temp folder. Take a look at a post here.

    http://dkochnev.blogspot.com/2011/06/microsoft-framework-40-wcf-service-and.html

    Best Regards.


    Haixia
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, January 24, 2013 6:03 AM
    Moderator