开发者

My code is being compiled to absolute paths!

I'm having problems deploying my application to a production server (shared hosting). Everything works fine on my development machine but not on the server due to absolute paths, here's a stack trace:

[SqlException (0x80131904): Login failed for user 'GLASGOW\IWPD_1479(fisharw)'.]
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +5009598
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() +234
   System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2275
   System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) +35
   System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, SqlConnection owningObject) +183
   System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, TimeoutTimer timeout) +239
   System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, TimeoutTimer timeout, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +195
   System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +232
   System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +185
   System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +33
   System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +524
   System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66
   System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +479
   System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +108
   System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +126
   System.Data.SqlClient.SqlConnection.Open() +125
   System.Data.SqlClient.SqlProviderServices.UsingConnection(SqlConnection sqlConnection, Action`1 act) +85
   System.Data.SqlClient.SqlProviderServices.UsingMasterConnection(SqlConnection sqlConnection, Action`1 act) +349
   System.Data.SqlClient.SqlProviderServices.GetDbProviderManifestToken(DbConnection connection) +265
   System.Data.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection) +34

[ProviderIncompatibleException: The provider did not return a ProviderManifestToken string.]
   System.Data.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection) +163
   System.Data.Entity.ModelConfiguration.Utilities.DbConnectionExtensions.GetProviderInfo(DbConnection connection, DbProviderManifest& providerManifest) +40
   System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection) +157
   System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext) +51
   System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput input) +117
   System.Data.Entity.Internal.LazyInternalContext.InitializeContext() +407
   System.Data.Entity.Internal.LazyInternalContext.get_ObjectContext() +15
   System.Data.Entity.DbContext.System.Data.Entity.Infrastructure.IObjectContextAdapter.get_ObjectContext() +20
   Sharwe.Data.DataAccess.SharweEntities..ctor() in C:\Users\Kassem\Desktop\Sharwe\Sharwe.Data\DataAccess\SharweEntities.cs:14
   Sharwe.Data.DataAccess.EfDatabaseFactory.GetDbContext() in C:\Users\Kassem\Desktop\Sharwe\Sharwe.Data\DataAccess\EFDatabaseFactory.cs:14
   Sharwe.Data.DataAccess.GenericMethodsRepository..ctor(IDatabaseFactory dbFactory) in C:\Users\Kassem\Desktop\Sharwe\Sharwe.Data\DataAccess\GenericMethodsRepository.cs:21
   lambda_method(Closure , IArguments ) +80
   StructureMap.Construction.<>c__DisplayClass2.<CreateBuilder>b__0(IArguments args) +22
   StructureMap.Construction.InstanceBuilder.BuildInstance(IArguments args) +12
   StructureMap.Pipeline.ConstructorInstance.Build(Type pluginType, BuildSession session, IInstanceBuilder builder) +88

[StructureMapException: StructureMap Exception Code:  207
Internal exception while creating Instance 'ac34765c-b076-4f77-be6e-eb4739ea2738' of PluginType Sharwe.Data.Abstract.IGenericMethodsRepository.  Check the inner exception for more details.]
   StructureMap.Pipeline.ConstructorInstance.Build(Type pluginType, BuildSession session, IInstanceBuilder builder) +276
   StructureMap.Pipeline.ConstructorInstance.build(Type pluginType, BuildSession session) +41
   StructureMap.Pipeline.SmartInstance`1.build(Type pluginType, BuildSession session) +43
   StructureMap.Pipeline.Instance.createRawObject(Type pluginType, BuildSession session) +45
   StructureMap.Pipeline.Instance.Build(Type pluginType, BuildSession session) +36
   StructureMap.Pipeline.ObjectBuilder.Resolve(Type pluginType, Instance instance, BuildSession session) +103
   StructureMap.BuildSession.CreateInstance(Type pluginType, Instance instance) +49
   StructureMap.<>c__DisplayClass3.<.ctor>b__1() +22
   StructureMap.BuildSession.CreateInstance(Type pluginType) +24
   StructureMap.Pipeline.DefaultInstance.build(Type pluginType, BuildSession session) +76
   StructureMap.Pipeline.Instance.createRawObject(Type pluginType, BuildSession session) +45
   StructureMap.Pipeline.Instance.Build(Type pluginType, BuildSession session) +36
   StructureMap.Pipeline.ConstructorInstance.Get(String propertyName, BuildSession session) +73
   StructureMap.Pipeline.Arguments.Get(String propertyName) +64
   lambda_method(Closure , IArguments ) +35
   StructureMap.Construction.<>c__DisplayClass2.<CreateBuilder>b__0(IArguments args) +22
   StructureMap.Construction.InstanceBuilder.BuildInstance(IArguments args) +12
   StructureMap.Pipeline.ConstructorInstance.Build(Type pluginType, BuildSession session, IInstanceBuilder builder) +98
   StructureMap.Pipeline.ConstructorInstance.build(Type pluginType, BuildSession session) +41
   StructureMap.Pipeline.SmartInstance`1.build(Type pluginType, BuildSession session) +43
   StructureMap.Pipeline.Instance.createRawObject(Type pluginType, BuildSession session) +45
   StructureMap.Pipeline.Instance.Build(Type pluginType, BuildSession session) +36
   StructureMap.Pipeline.ObjectBuilder.Resolve(Type pluginType, Instance instance, BuildSession session) +103
   StructureMap.BuildSession.CreateInstance(Type pluginType, Instance instance) +49
   StructureMap.<>c__DisplayClass3.<.ctor>b__1() +22
   StructureMap.BuildSession.CreateInstance(Type pluginType) +24
   StructureMap.Pipeline.DefaultInstance.build(Type pluginType, BuildSession session) +76
   StructureMap.Pipeline.Instance.createRawObject(Type pluginType, BuildSession session) +45
   StructureMap.Pipeline.Instance.Build(Type pluginType, BuildSession session) +36
   StructureMap.Pipeline.ConstructorInstance.Get(String propertyName, BuildSession session) +73
   StructureMap.Pipeline.Arguments.Get(String propertyName) +64
   lambda_method(Closure , IArguments ) +35
   StructureMap.Construction.<>c__DisplayClass2.<CreateBuilder>b__0(IArguments args) +22
   StructureMap.Construction.InstanceBuilder.BuildInstance(IArguments args) +12
   StructureMap.Pipeline.ConstructorInstance.Build(Type pluginType, BuildSession session, IInstanceBuilder builder) +98
   StructureMap.Pipeline.ConstructorInstance.build(Type pluginType, BuildSession session) +41
   StructureMap.Pipeline.Instance.createRawObject(Type pluginType, BuildSession session) +45
   StructureMap.Pipeline.Instance.Build(Type pluginType, BuildSession session) +36
   StructureMap.Pipeline.ObjectBuilder.Resolve(Type pluginType, Instance instance, BuildSession session) +103
   StructureMap.BuildSession.CreateInstance(Type pluginType, Instance instance) +49
   StructureMap.<>c__DisplayClass3.<.ctor>b__1() +22
   StructureMap.BuildSession.CreateInstance(Type pluginType) +24
   StructureMap.Container.GetInstance(Type pluginType) +67
   Sharwe.MVC.Services.StructureMapDependencyResolver.GetService(Type serviceType) in C:\Users\Kassem\Desktop\Sharwe\Sharwe\Services\StructureMapDependencyResolver.cs:24
   System.Web.Mvc.DefaultControllerActivator.Create(RequestContext requestContext, Type controllerType) +51

[InvalidOperationException: An error occurred when trying to create a controller of type 'Sharwe.MVC.Controllers.HomeController'. Make sure that the controller has a parameterless public constructor.]
   System.Web.Mvc.DefaultControllerActivator.Create(RequestContext requestContext, Type controllerType) +182
   System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType) +80
   Sys开发者_运维知识库tem.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) +74
   System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory) +196
   System.Web.Mvc.<>c__DisplayClass6.<BeginProcessRequest>b__2() +49
   System.Web.Mvc.<>c__DisplayClassb`1.<ProcessInApplicationTrust>b__a() +13
   System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7
   System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +22
   System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Func`1 func) +124
   System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +98
   System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state) +50
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) +16
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8841400
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184

So as you can see, there are several places where it says C:\Users\Kassem\Desktop\Sharwe\Sharwe\ which is where the project is located on my local machine. I do not understand why the code compiled this way, shouldn't it use relative paths automatically?

Note: My solution is divided into 3 projects, one of them is an ASP.NET MVC3 application which references the other projects (code libraries). In order to compile the whole project I right clicked on the MVC3 project and chose Build, and from there I deployed to a local directory then uploaded the files to the server.

Any suggestions?


This is just debug information embedded in the pdb file.... That's all. It's used when debugging to find the original source code.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜