OfirD
OfirD

Reputation: 10460

HTTP Error 404.7 - Is there any other option to solve it?

I've started learning web services with ASP.NET. When doing a quick search on how to build and use a simple web service, this page seemed nice and simple.

I followed the instruction "copy FirstService.asmx in the IIS virtual directory...[and] open the web service" (actually, it is displayed as FirstService.asmx.cs), but from there on problems started. I got several HTTP Error (as explained here, I gave permissions to both IUSR and IIS_USRS, though the latter is probably irrelevant) and I'm now stuck with Error 404.7.

I tried the suggestions of these two (1, 2) SO posts (so I now have a second file on my folder, a Web.config file, though the site linked above said nothing about Web.config files), nothing helped.

Note that I also followed this page to register the correct version of ASP.NET with IIS.

Is there any other option?

EDIT:

Windows 7 Ultimate (64-bit), IIS 7.5

Full error (pardon the graphics):

Error Summary

HTTP Error 404.7 - Not Found The request filtering module is configured to deny the file extension.

Detailed Error Information

Module: RequestFilteringModule

Notification: BeginRequest

Handler: StaticFile

Error Code: 0x00000000

Requested URL: http://localhost:80/MyWebServices/WebService1.asmx.cs

Physical Path: C:\Users\home\Desktop\MyWebServices\WebService1.asmx.cs

Logon Method: Not yet determined

Logon User: Not yet determined

My Web.config:

<?xml version="1.0" encoding="UTF-8"?>

<configuration>
  <system.webServer>
    <security>
      <requestFiltering>
        <fileExtensions allowUnlisted="true">
          <remove fileExtension="." />
          <add fileExtension="." allowed="true" />
        </fileExtensions>
      </requestFiltering>
    </security>
  </system.webServer>
</configuration>

Upvotes: 0

Views: 11532

Answers (1)

Mairaj Ahmad
Mairaj Ahmad

Reputation: 14604

.cs is a code file and by default all .cs files are not allowed to be browsed in browser of course due to security concerns as all code is in there.

Also if you want to browse your webservice you don't need to browse .cs file you need to browse following

http://localhost:80/MyWebServices/WebService1.asmx

If MIME Type for asmx is not added you will need to added MIME Type for asmx.

  • Go to IIS
  • Select Your Website/Webservice on left side.
  • Select MIME Types.
  • Select Add on top right.
  • Add .asmx in File Name extension and text/xml in MIME Tpe

Upvotes: 1

Related Questions