json 요청 및 응답을 로깅하기 위해 'JsonLogger'라는 자체 HttpModule을 만들었습니다.web.config에 IHttpModule.properties 설정
로깅을 위해 연결 문자열이 필요합니다.
연결 문자열을 찾으려면 web.config에 하나를 추가하고 코드로 가져옵니다. 그 ConnectionString을이 거기에 왜
의 web.config는
<connectionStrings>
<add name="WebShopConfiguration" connectionString="myConString"/>
</connectionStrings>
<system.web>
<httpModules>
<add name="JsonLogger" type="ServiceModel.Logging.JsonLogger, ServiceModel"/>
</httpModules>
</system.web>
<system.webServer>
<modules>
<add name="JsonLogger" type="ServiceModel.Logging.JsonLogger, ServiceModel"/>
</modules>
</system.webServer>
HttpModule을
ConnectionString = System.Configuration.ConfigurationManager.
ConnectionStrings["WebShopConfiguration"].ConnectionString;
모든 것이 잘 작동하지만, IMO이 깨끗하지 않다 (미래의 개발자는 알 수 없습니다 내 web.config).
내 web.config에 httpmodule을 추가하는 connectionstring을 채우고 싶습니다. 나는이 시도하지만 (나는 이미 생각처럼)이 작동하지 않습니다 :
의 Web.config
<add name="JsonLogger" type="ServiceModel.Logging.JsonLogger, ServiceModel" ConnectionString="myConString"/>
재산권 HttpModule을
[ConfigurationProperty("ConnectionString", DefaultValue = "", IsRequired = true, IsKey = false)]
public string ConnectionString { get; set; }
내가 여전히 연구를 돈 후 이것을하는 방법을 찾지 못합니다. 내가 성취하려는 것이 가능하면 누구나 아는가?
많은 감사, 의 Kjell