I've created a web service, using vs 2017, .net 4.61. The web service works like a charm when I browse from the server using iis, but if I test on my local machine, the invoke button disappears.
I've tried adding in the following code, just above the section in the web.config file -
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
but I get an error "The configuration section 'webServices' cannot be read because it is missing a section declaration".
Where am I going wrong?
The following was added after the connectionStrings section -
<system.web>
<compilation debug="true" targetFramework="4.6.1" />
<httpRuntime targetFramework="4.6.1" />
<webServices>
<protocols>
<add name="HttpSoap12"/>
<add name="HttpSoap"/>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>
</system.web>
I am trying to disable access to Sitemap.xml file outside the production environment. currently if user types http://localhost:62777/sitemap.xml it is accessible but i want to restrict it. currently i tried as below but no luck
<location path="sitemap.xml">
<system.web>
<authorization>
<deny users="?"/>
</authorization>
</system.web>
</location>
is there any other way to disable it from outside the production environment? Thanks in advance.
i tried as below also but not working
<httpHandlers>
<add path="sitemap.xml" verb="*" type="System.Web.HttpForbiddenHandler" name="xml (integrated)" preCondition="integratedMode" />
</httpHandlers>
Why in the world do you want to "restrict" it? /sitemap.xml needs to be publicly available or the search engines (which is what it is for) won't read it. See the protocol definition on Sitemaps.org.
That said, if you don't want to use it for some reason (such as rolling your own sitemap solution or if your site is not Internet facing), you can disable it.
<appSettings>
<add key="MvcSiteMapProvider_EnableSitemapsXml" value="false"/>
</appSettings>
you can add in IIS Please see here
I am trying to build a desktop application that uses client application services to authenticate users through an ASP.Net MVC web app. The trouble is I can't seem to get the value for "Authentication service location" correct. It has something to do with the fact that I cannot find Authentication_JSON_AppService.axd when I browse to the default URL which is http://localhost55555/Authentication_JSON_AppService.axd.
Please can somebody help me implement this correctly.
Add this to your web.config:
<system.web.extensions>
<scripting>
<webServices>
<authenticationService enabled="true" requireSSL="false"/>
</webServices>
</scripting>
</system.web.extensions>
Also check your web.config for:
<httpHandlers>
....
<add verb="*" path="*_AppService.axd" validate=...
....
i am pretty new to MVC and Routing and i was asked to modify an app to use diffrent url's.
a task that is a bit over me since i have no experience.
ok, lets talk a bit of code:
routes.MapRoute(
"CategoryBySeName", // Route name
"products/{SeName}", // URL with parameters
new { controller = "Catalog", action = "CategoryBySeName" }
);
this works as expected, but then the client wanted ".html" at the end of paths, so i changed:
"products/{SeName}", // URL with parameters
to:
"products/{SeName}.html", // URL with parameters
which fails ( IIS 404 page - MapRequestHandler)
it seems like iis is trying to load a physical file with that name instead of passing it to the application.
Similar: ASP.NET MVC Routing to start at html page (not answered, Not duplicate)
You have to force all request through the ASP.NET pipeline, and you can do that by adding only this single line to the web.config of your application:
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
You're guess that an IIS handler is probably grabbing the request prior to MVC is likely correct.
Assuming IIS 7:
http://technet.microsoft.com/en-us/library/cc770990(v=ws.10).aspx
You need to edit the .html handler in IIS to use ASP.NET.
You can find it in the website properties under the home directory tab in app configuration in the mappings section in II6.
Something along the lines of (version may be different):
C:\windows\microsoft.net\framework\v4.0.30319\aspnet_isapi.dll is what you need to handle the .html files.
Changing the Application Pool from Classic to Integrated fixed the issue.
thank you guyz for your help.
Just add this section to Web.config, and all requests to the route/{*pathInfo} will be handled by the specified handler, even when there are dots in pathInfo. (taken from ServiceStack MVC Host Web.config example and this answer https://stackoverflow.com/a/12151501/801189)
<location path="route">
<system.web>
<httpHandlers>
<add path="*" type="System.Web.Handlers.TransferRequestHandler" verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" />
</httpHandlers>
</system.web>
<!-- Required for IIS 7.0 -->
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<add name="ApiURIs-ISAPI-Integrated-4.0" path="*" type="System.Web.Handlers.TransferRequestHandler" verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
</system.webServer>
</location>
This is link which is explaining in detail, the problem i am facing right now.
I am getting a frequent exception whenever a call made to my web services. It returns appropriate results but still complaining about URL format.:-
Request format is unrecognized for URL
unexpectedly ending in
/WebServiceMethod
So what do you suggest guys?
Thanks.
There is quite a common issue that causes this error, that can easily be fixed by adding
<configuration>
<system.web>
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>
</system.web>
</configuration>
...to web.config. Hopefully that fixes it for you.