我正在尝试使用以下app.config设置程序集绑定重定向:
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.AnalysisServices"
PublicKeyToken="89845dcd8080cc91" />
<bindingRedirect oldVersion="10.0.0.0"
newVersion="9.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Run Code Online (Sandbox Code Playgroud)
我在GAC中使用版本9.0.242.0的计算机上运行该程序,并使用指定的公钥令牌.CLR似乎甚至没有尝试重定向绑定以使用该版本.
这是我在fuslogvw.exe中得到的:
LOG: This bind starts in default load context.
LOG: Using application configuration file: \Debug\AssemblyRedirectPOC.exe.Config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: Microsoft.AnalysisServices, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL /Debug/Microsoft.AnalysisServices.DLL.
LOG: Attempting download of new URL /Debug/Microsoft.AnalysisServices/Microsoft.AnalysisServices.DLL.
LOG: Attempting download of new URL /Debug/Microsoft.AnalysisServices.EXE.
LOG: Attempting download of new URL …
我需要在IIS中修改某些HttpRequests(SSAS连接字符串)的内容.基本上,我需要向请求中包含的SOAP添加一个元素.
到目前为止,我的方法是向HttpRequest添加一个Filter,并在过滤器的Read方法中执行更改.据我所知,Read永远不会被执行.
我对Request.Filter的理解是它从IIS处理请求时读取,因此IIS应该看到我修改过的Request.
我正在尝试使用HttpModule实际可行的是我的Filter方法是否正确?
如果是这样,什么会导致Read不被击中?
这是我的代码的简化版本:
public class CustomHttpModule : IHttpModule {
private HttpApplication app;
public string ModuleName {
get { return "CustomHttpModule"; }
}
public void Init(HttpApplication context) {
app = context;
context.PreRequestHandlerExecute += new EventHandler(context_PreRequestHandlerExecute);
}
void context_PreRequestHandlerExecute(object sender, EventArgs e) {
var request = app.Context.Request;
request.Filter = new CustomHttpFilter(request.Filter);
}
}
public class CustomHttpFilter : Stream {
private Stream outputStream;
public CustomHttpFilter(Stream outputFilter) {
outputStream = outputFilter;
}
public override int Read(byte[] buffer, int offset, int count) …Run Code Online (Sandbox Code Playgroud) c# ×2
.net ×1
assemblies ×1
binding ×1
httpmodule ×1
httprequest ×1
iis ×1
reference ×1
ssas ×1