简体   繁体   中英

How to serve compiled web service on IIS?

I was given just a folder with an .asmx and previously compiled /bin folder with DLLs. I'm trying to run this web service on my local machine but I'm getting an error.

So far I did the following:

  1. Installed IIS
  2. Created an application 'myWebService' under 'default web site' in IIS
  3. Pointed to the c:\\inetpub\\wwwroot\\myWebService

when I browse to http://localhost/myWebService

HTTP Error 404.3 - Not Found The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map

As far as I know, the 404.3 error means there is no handler which could handle the asmx file when the request comes to the IIS.

I suggest you could firstly check you have the webservicehanlderfactory in your application's handler mapping. 在此处输入图片说明

If there is no such handler mapping, I suggest you could try below solution to install it.

For the server:

Go to Server Manager > Add roles and features Select your server from the server pool Go to Features > WCF Services I selected all categories then installed

For the Windows10:

Open the control panel > Windows features > Select the IIS >World wide web service and enable below settings:

在此处输入图片说明

Besides, if you want to host the asmx on the IIS, you should also have the right web.config file.

I suggest you could ask the provider to get the config file. If you don't get it, you couldn't run the web service well.

Web.config example:

<?xml version="1.0"?>
<configuration>

  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.8" />
    <httpRuntime targetFramework="4.8"/>
  </system.web>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <protocolMapping>
        <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>    
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <!--
        To browse web app root directory during debugging, set the value below to true.
        Set to false before deployment to avoid disclosing web app folder information.
      -->
    <directoryBrowse enabled="true"/>
  </system.webServer>

</configuration>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM