unchek checkbox "Start WCF Service Host when debugging another project in the same solution" in WCF options in project settings
In the project that reference your IService Class. Right Click on your project -> Properties -> WCF Options -> Check/Uncheck "Start WCF Service Host when debugging another project in the same solution"
adding this into your web.config
<system.webServer>
<directoryBrowse enabled="true"/>
</system.webServer>
參考資料
錯誤發生是因為在頁面(ex:default.aspx)有用到ASP.NET的控件SiteMap,會先去讀取Web.Config裡關於siteMap的設定.
當Web.Config找不到siteMap設定時,會轉往machine.config找siteMap的設定,但machine.config內的MySqlSiteMapProvider設定是無法正常執行,導致報錯.
有2個解決方法:
方法1: 註解掉machine.config內關於siteMap的設定
方法2: Web.Config增加siteMap設定,且必須設定defaultProvider,在providers先clear.(如下)
<siteMap defaultProvider="PageSiteMap">
<providers>
<clear/>
<add name="PageSiteMap" type="System.Web.XmlSiteMapProvider" siteMapFile="~/Web.sitemap" />
</providers>
</siteMap>
參考資料 參考資料 參考資料 參考資料 參考資料 參考資料 參考資料
<div>
<asp:TreeView ID="TreeView1" runat="server">
<Nodes>
<asp:TreeNode Text="Home" NavigateUrl="~/Home.aspx" Target="_blank" />
<asp:TreeNode Text="Employee" NavigateUrl="~/Employee.aspx" Target="_blank" />
<asp:TreeNode Text="Upload Resume" NavigateUrl="~/Upload_Resume.aspx" Target="_blank" />
<asp:TreeNode Text="Edit Resume" NavigateUrl="~/Edit_Resume.aspx" Target="_blank" />
<asp:TreeNode Text="View Resume" NavigateUrl="~/View_Resume.aspx" Target="_blank" />
<asp:TreeNode Text="Employer" NavigateUrl="~/Employer.aspx" Target="_blank">
<asp:TreeNode Text="Upload Job" NavigateUrl="~/Upload_Job.aspx" Target="_blank" />
<asp:TreeNode Text="Edit Job" NavigateUrl="~/Edit_Job.aspx" Target="_blank" />
<asp:TreeNode Text="View Job" NavigateUrl="~/View_Job.aspx" Target="_blank" />
</asp:TreeNode>
<asp:TreeNode Text="Admin" NavigateUrl="~/Admin.aspx" Target="_blank">
<asp:TreeNode Text="Add User" NavigateUrl="~/Add_User.aspx" Target="_blank" />
<asp:TreeNode Text="Edit User" NavigateUrl="~/Edit_Use.aspx" Target="_blank" />
<asp:TreeNode Text="View User" NavigateUrl="~/View_User.aspx" Target="_blank" />
</asp:TreeNode>
</Nodes>
</asp:TreeView>
</div>
參考資料
1.複製xxx.sln,並將原xxx.sln改名為xxx2008.sln
2.修改xxx.sln
將Visual Studio Solution File, Format Version 10.00 改為
Visual Studio Solution File, Format Version 11.00
3.修改xxx.csproj
將ToolsVersion="3.5" 改為
ToolsVersion="4.0"
4.修改xxx.csproj
將<ProjectTypeGuids>{14822709-B5A1-4724-98CA-57A101D1B079};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
註解
5.新增xxx.Workflow.sln