<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>C# &#8211; acm&#039;s blog</title>
	<atom:link href="https://blog.acm.idv.tw/tag/c/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.acm.idv.tw</link>
	<description>技術與生活隨筆</description>
	<lastBuildDate>Sun, 17 Jul 2022 12:12:24 +0000</lastBuildDate>
	<language>zh-TW</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8</generator>

<image>
	<url>https://blog.acm.idv.tw/wp-content/uploads/2022/06/cropped-logo_kaffa9-3-32x32.png</url>
	<title>C# &#8211; acm&#039;s blog</title>
	<link>https://blog.acm.idv.tw</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>[ASP.NET] Web Service (.asmx) 遇到404問題</title>
		<link>https://blog.acm.idv.tw/2019/07/17/aspnet-web-service-asmx-404/</link>
					<comments>https://blog.acm.idv.tw/2019/07/17/aspnet-web-service-asmx-404/#respond</comments>
		
		<dc:creator><![CDATA[kaffa9]]></dc:creator>
		<pubDate>Wed, 17 Jul 2019 01:26:00 +0000</pubDate>
				<category><![CDATA[技術]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<guid isPermaLink="false"></guid>

					<description><![CDATA[昨天在傳統Web Service (.asmx)上遇到直接存取.asmx頁面正常，可秀出Documentation說明（如果Web.Config沒有將Docum...<p class="read-more"><a class="btn btn-default" href="https://blog.acm.idv.tw/2019/07/17/aspnet-web-service-asmx-404/"> Read More<span class="screen-reader-text">  Read More</span></a></p>]]></description>
										<content:encoded><![CDATA[<p>昨天在傳統Web Service (.asmx)上遇到直接存取.asmx頁面正常，可秀出Documentation說明（如果Web.Config沒有將Documentation remove掉的話），但POST/GET過去IIS會回應404 Not Found的問題。</p>
<p>查了老半天，才發現是專案類型為ASP.NET MVC專案導致的，會將：</p>
<blockquote class="tr_bq"><p>
<span style="color: #6fa8dc; font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">http://{site}/Foo.asmx/Bar</span></p></blockquote>
<p>這類的URL，以MVC的路由來處理，因為找不到對應的Controller，自然就得到404。</p>
<p>解決方法是在 RouteConfig.cs 新增 .asmx 檔的處理規則：</p>
<pre class="csharp">
    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.IgnoreRoute("{resource}.asmx/{*pathInfo}");

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            );
        }
    }
</pre>
<p></p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.acm.idv.tw/2019/07/17/aspnet-web-service-asmx-404/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
