2014-11-03 63 views
0

即時通訊試圖建立和實體框架,將使用sql-server 2008 genarating數據庫與代碼第一approche ....所以我只是開始創建2類包含一些測試它的特性.. (用asp.net):什麼會導致我的iis不允許瀏覽目錄?

使類文章:

public class Articles 
{ 
    public int ID { get; set; } 
    public string desc{ get; set; } 
    public decimal price { get; set; } 

    public Articles() 
    { 

    } 
} 

使課堂商店:

public class Stores 
{ 

    int ID { get; set; } 
    String Name { get; set; } 
    List<Articles> Elements { get; set; } 

    public Stores() 
    { 

    } 
} 

Afther使得Context類:

public class dbSroreContext : DbContext 
{ 

    public DbSet<Stores> Stores { get; set; } 
    public DbSet<Articles> Articles { get; set; } 

    public dbSroreContext() 
    { 

    } 

}

確定,然後即時把連接字符串在我的web.config文件:

<configuration> 


    <configSections> 

    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> 


    </configSections> 
<system.webServer> 
    <modules runAllManagedModulesForAllRequests="true"/> 
</system.webServer> 
    <connectionStrings> 
    <add connectionString="Server.;" 
     name="dbSroreContext" 
     providerName="System.Data.SqlClient" 
     /> 
    </connectionStrings> 
    <system.web> 

    <compilation debug="true" targetFramework="4.5"/> 
    <httpRuntime targetFramework="4.5"/> 
    </system.web> 

</configuration> 

到目前爲止,我試圖讓我的目錄瀏覽器在我的IIS,但沒有結果。 ...

Error : The Web server is configured to not list the contents of this directory. 

Most likely causes: 
A default document is not configured for the requested URL, and directory browsing is not enabled on the server. 
+0

爲什麼你不啓用目錄瀏覽,因爲錯誤消息建議?這裏有一些提示http://technet.microsoft.com/en-us/library/cc731109(v=ws.10).aspx http://www.iis.net/configreference/system.webserver/directorybrowse – Sam 2014-11-03 21:56:30

+0

allready did它對我來說什麼都不做:P – user3718713 2014-11-03 22:01:51

+0

目錄瀏覽與你正在嘗試構建的代碼無關 - 問題是你有一些EF類但沒有Web應用程序。 – 2014-11-03 23:16:24

回答

0

好吧finaly我得到了我最好的解決方案!我有更多的一臺服務器在我的電腦上...這是搞亂服務器啓用瀏覽目錄的東西!所以我可以做我天衣的最好的事情是從網站級別啓用它:

<system.webServer> 
    <directoryBrowse enabled="true"/> 
    <modules runAllManagedModulesForAllRequests="true"/> 
</system.webServer> 

在web.config文件中添加這一點,它應該罰款!我希望它可以幫助其他人:嘗試提供幫助! :D

相關問題