对webservice的路径重写问题,急,在线等!!
<?xml version="1.0" encoding="utf-8"?><configuration> <configSections> <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" > <section name="rest.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> </sectionGroup> <section name="RewriterConfig" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter"/> </configSections> <connectionStrings/> <system.web> <httpHandlers> <add verb="*" path="*" type="URLRewriter.RewriterFactoryHandler, URLRewriter" /> <add verb="*" path="*.aspx" type="URLRewriter.RewriterFactoryHandler, URLRewriter" /> <add verb="*" path="*.asmx" type="URLRewriter.RewriterFactoryHandler, URLRewriter" /> </httpHandlers> <compilation debug="true" > <assemblies> <add assembly="MySql.Data, Version=6.2.3.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D"/> </assemblies> </compilation> <webServices> <protocols> <add name="HttpSoap"/> <add name="HttpPost"/> <add name="HttpGet"/> <add name="Documentation"/> </protocols> </webServices> <authentication mode="Windows" /> </system.web> <RewriterConfig> <Rules> <RewriterRule> <LookFor>~/WebForm99</LookFor> <SendTo>~/WebForm1.aspx</SendTo> </RewriterRule> <RewriterRule> <LookFor>~/Test</LookFor> <SendTo>~/Service1\.asmx/Test</SendTo> </RewriterRule> </Rules> </RewriterConfig></configuration>
无法将类型为“rest.Service1”的对象强制转换为类型“System.Web.IHttpHandler”。
<LookFor>~/Test</LookFor> <SendTo>~/Service1\.asmx/Test</SendTo>这里好像不应该这么写<LookFor>~/Test</LookFor> <SendTo>~/Service1\.asmx</SendTo>直接应该这样吧!