我正在開發一個需要提供身份驗證以及角色和配置文件管理的C#Web服務。我需要每個配置文件都具有List類型的屬性。在web.config配置文件部分看起來是這樣的:在.NET中使用List類型的配置文件屬性成員
<profile defaultProvider="MyProfileProvider" enabled="true">
<providers>
<remove name="MyProfileProvider"/>
<add connectionStringName="MySqlServer"
applicationName="MyApp"
name="MyProfileProvider"
type="System.Web.Profile.SqlProfileProvider" />
</providers>
<properties>
<add name="Websites" type="System.Collections.Generic.List<String>" serializeAs="Binary"/>
</properties>
</profile>
然而,當我開始在互聯網服務和嘗試訪問它返回以下錯誤性質:
System.Configuration.ConfigurationErrorsException:嘗試加載此屬性的類型導致以下錯誤:無法加載類型'System.Collections.Generic.List <字符串>'。 (C:\ Projects \ MyProject \ web.config 58行)---> System.Web.HttpException:無法加載類型'System.Collections.Generic.List <字符串>'。
有沒有辦法使用泛型集合來達到此目的?