vs2013開發web api service時,使用vs開發服務器調試沒有問題,但將項目放到另一台電腦調試(vs2010),總會提示
無法再以下端口啟動asp.net開發服務器
錯誤:通常每個套接字地址 只允許使用一次
於是決定不用vs開發服務器,而是使用本地IIS web服務器
若此時項目URL填寫http://localhost:8809這樣的端口形式,點擊保存會提示
無法創建虛擬目錄。在本地計算機上,未能找到服務器“http://localhost:8809”。只有本地IIS服務器支持創建虛擬目錄。
解決方法為將URL改為http://localhost/服務器的樣式,保存即可,此時csproj文件類似如下樣式:
<VisualStudio> <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}"> <WebProjectProperties> <UseIIS>True</UseIIS> <AutoAssignPort>False</AutoAssignPort> <DevelopmentServerPort>58109</DevelopmentServerPort> <DevelopmentServerVPath>/</DevelopmentServerVPath> <IISUrl>http://localhost/TC.PTP.Test.Service</IISUrl> <NTLMAuthentication>False</NTLMAuthentication> <UseCustomServer>False</UseCustomServer> <CustomServerUrl> </CustomServerUrl> <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile> </WebProjectProperties> </FlavorProperties> </VisualStudio>