将MVC应用程序发布到azure

时间:2016-03-08 22:52:54

标签: asp.net-mvc entity-framework azure

它适用于本地。我将连接字符串更改为azure db并修复了一些引用以实现此目的。

$('h1:first').html(function(){
  return $(this).html() + ' some more html';
});

2 个答案:

答案 0 :(得分:1)

尝试关闭连接池,在连接字符串中设置import sqlalchemy as sa from sqlalchemy.ext.declarative import declarative_base from decimal import Decimal engine = sa.create_engine('sqlite:///:memory:') Base = declarative_base() session = sa.orm.sessionmaker(bind=engine)() class OrderItem(Base): __tablename__ = 'order' id = sa.Column('id', sa.Integer, primary_key=True) product_id = sa.Column('product_id', sa.Integer, sa.ForeignKey('product.id')) user_id = sa.Column('user_id', sa.Integer, sa.ForeignKey('user.id')) qty = sa.Column('qty', sa.Integer) class Product(Base): __tablename__ = 'product' id = sa.Column('id', sa.Integer, primary_key=True) price = sa.Column('price', sa.Numeric(14,2)) class User(Base): __tablename__ = 'user' id = sa.Column('id', sa.Integer, primary_key=True) first_name = sa.Column('first_name', sa.Text) last_name = sa.Column('last_name', sa.Text) Base.metadata.create_all(engine) engine.echo = True session.add(User(id=42, first_name='John', last_name='Cleese')) session.add(User(id=13, first_name='Sir', last_name='Robin')) session.add(Product(id=1, price=Decimal('2.10'))) session.add(OrderItem(product_id=1, user_id=42, qty=9)) session.add(OrderItem(product_id=1, user_id=42, qty=2)) session.add(OrderItem(product_id=1, user_id=13, qty=2)) session.add(OrderItem(product_id=1, user_id=13, qty=3)) session.add(OrderItem(product_id=1, user_id=13, qty=20)) session.commit() query = session.query( (User.first_name + ' ' + User.last_name).label('seller'), sa.func.count(OrderItem.id).label('unique_items'), sa.func.sum(OrderItem.qty).label('items_total'), sa.func.sum(OrderItem.qty * Product.price).label('order_amount'), ).join(OrderItem).join(Product).group_by(User.id).order_by('items_total', 'order_amount') print('{0:=^40}\n{1:^40}\n{0:=^40}'.format('=', 'Query')) results = [row for row in session.execute(query)] print('{0:=^40}\n{1:^40}\n{0:=^40}'.format('=', 'Results')) for row in results: print(dict(row))

答案 1 :(得分:0)

如果没有看到您的实际连接字符串,我无法完全确定;但是,从堆栈跟踪错误的外观来看,它表明您的连接字符串正在使用:

providerName="System.Data.EntityClient"

尝试将连接字符串附加到:

providerName="System.Data.SqlClient"